Posts

Showing posts from June, 2010

c# - Direct3D 11 WorldViewProjection Matrix Transformation Not Working -

i have simple square i'm drawing in 3d space using direct3d 11 , slimdx, following coordinates (i know renders) 0,0,0.5 0,0.5,0.5 0.5,0.5,0.5 0.5,0,0.5 i have camera class handles camera movement applying matrix transformations viewmatrix. e.g. camera.moveforward(float x) moves camera forward x. holds view , projection matrices. instantiate them using following code: matrix view = matrix.lookatlh( new vector3(0f, 0f, -5f), new vector3(0f, 0f, 0f), new vector3(0f, 1f, 0f)); matrix projection = matrix.perspectivefovlh( (float)math.pi/2, windowwidth/windowheight, 0.1f, 110f); the world matrix set identity matrix. in shader code transform coordinates using following code: ps_in vs(vs_in input) { ps_in output = (ps_in)0; output.pos = mul( input.pos, worldviewprojection ); output.col = float4(1,1,1,1); return output; } where worldviewprojection set in code using following: matrix worldview = matrix.multiply(world, camera.v...

visual studio 2010 - VS2010 and Create Unit Tests... no tests generated -

i'm trying add unit tests existing code base using visual studio 2010's unit test generator. however, in cases when open class, right click --> create unit tests..., after select methods generate tests create blank test. there situations can happen? in every case select @ least 1 public method gen tests for, , generates this: using txrp.controllers; //the location of code tested using microsoft.visualstudio.testtools.unittesting; that's it. nothing else. strange, right? i should note mvc 2 controller code, , have been able gen tests other controllers no problem, , controllers follow pretty same format. no error seems thrown, gens empty page happily , adds project if fine. has had experience same type of thing happening, , there answer found why? update: there in fact error during generation: while trying generate tests, following errors occurred: value cannot null. parameter name: key after research, possible solution found error occurrs if y...

java - How to get List<Y> from Map<X,Y> by providing List<X> using google collection? -

i have map<x, y> , list<x> , extract values map<x, y> providing list<x> , result in list<y> . 1 way list<x> keys = getkeys(); map<x, y> map = getmap(); list<y> values = lists.newarraylistwithcapacity(keys.size()); for(x x : keys){ values.add(map.get(x)); } now again need remove nulls in values ( list<y> ) using predicate or something. better way this? there reason why method isn't there in google collections library? something this: list<y> values = lists.newarraylist( iterables.filter( lists.transform(getkeys(), functions.formap(getmap(), null), predicates.notnull()));

python - Is SimpleXMLRPCServer single threaded? -

possible duplicate: python xmlrpc concurrent requests i'm writing python application act xml-rpc server, using simplexmlrpcserver class. now question is: happens if 2 or more clients send request @ same time? queued? have guarantee if 2 clients call same or different functions executed 1 after , not @ same time? i believe library implementation of simplexmlrpcserver indeed single-threaded. have add mixin make serve requests in multi-threaded way: from socketserver import threadingmixin simplexmlrpcserver import simplexmlrpcserver class myxmlrpcserver(threadingmixin, simplexmlrpcserver): """..."""

kml - Can't get android to write GeoPoint GPS coordinate data to a file correctly -

im writing software android takes gps data in form of arraylist of geopoints , writes kml file. rest of file created fine, when gps data written file in following way: for(int i=0; < geopoints.size(); i++){ writer.write(geopoints.get(i).getlatitudee6()); writer.write(", "); writer.write(geopoints.get(i).getlongitudee6()); writer.write("\n"); } the output of file random characters: ꗺ, 繿 ꔚ, 练 鬅, 眑 if change loop convert string: for(int i=0; < geopoints.size(); i++){ writer.write(integer.tostring(geopoints.get(i).getlatitudee6())); writer.write(", "); writer.write(integer.tostring(geopoints.get(i).getlongitudee6())); writer.write("\n"); } then output correct, there isn't decimal place? -45570790, 167608003 -45571713, 167608345 -45572973, 167606660 can me find pesky decimal? e6 means lat * 1e6, -45.57 vs -45570790 need divide 1e6. for(int i=0; < geopoints.size(); i++)...

PHP proxy to get XML: problem with URL arguments -

so need retrieve xml public api, app in flash , public service won't implement crossdomain.xml file. found php script online (below) proxy request url. works fine urls like: http://mysite.com/xml_proxy.php?url=http://rss.cnn.com/rss/cnn_topstories.rss but script seems either strip or ignore arguments on url, like: http://mysite.com/xml_proxy.php?url=http://publicapiserver.com?app_id=35235x&app_key=84x i'm php ignorant. there easy way have script process url arguments? much. here script: <?php $post_data = $http_raw_post_data; $header[] = "content-type: text/xml"; $header[] = "content-length: ".strlen($post_data); $ch = curl_init( $_get['url'] ); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_timeout, 10); curl_setopt($ch, curlopt_httpheader, $header); if ( strlen($post_data)>0 ){ curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $post_data); } $response = curl_exec($ch...

oop - How should we use ASP.NET Data Access Classes (Converting from ColdFusion) -

we're converting coldfusion asp.net 4.0 , don't know route take setting our classes. in college taught break separate data access classes , entity classes speak dac. me, that's best option team needs lot of control on classes , needs reuse multiple items. then there linq... sure.. it's great , fast! have no problems writing own queries though. me, it's not need. none of on team need linq actually. i think should using folders contain our daclasses , folders contain our entity classes. have our actual .aspx presentation pages. any ideas on route should taking? if you're going go through pain of moving existing platform new 1 anyway, @ asp.net mvc . the model-view-controller methodology potentially cleaner way of thinking web development, , achieves separation of concerns team seems worried about. on different note, make sound linq , other such technologies crutches. not unless use them way (as in, not being able data access without it). ...

mysql - Loop through an array to unset a known value and implode to sql -

i have 2 set of arrays in different mysql table. want do want table_one connect table. value want session_id array associated value (session_id) explode array individual values. now::::: - go table_two table_two go straight first value array (table_one) explode array associated it. delete number that's equal session_id _____________________________________________________ , fort.... more visual explanation below: session_id = 4 table_one: id array1 1 4 2 1 3 2,5 4 1,3,4,5 5 4,5 table_two: id array2 1 4,6,9,2 2 3,7,8,2 3 7,12,4,9 4 1,5,4,8 5 3,6,12,3,5,4 so, be...

Import existing c++ project into Xcode IDE -

i trying open existing c++ open-source library in xcode publish own modification/additions. library tesseract-ocr , not include .xcodeprojet file. since xcode can function ide, possible open bunch of files single project in xcode? there easy way produce xcode project? there several ways it, depending on level of ide integration want. there's no direct way of importing makefile-based project xcode. can create project builds via makefile, wouldn't many of benefits of using ide, since editor features such word completion rely on xcode being able parse files in project. able use debugger though. this, create new project , add custom target script build phase calls down makefile. if project you're building compiles easily, ie without requiring lot of macros set up, include paths, etc, may simple create empty project , merely add source files it. i've used method extensively building boost libraries. if configure && make type project have run ...

nsstring - Help with Xcode drawRect using textfield to input value -

i trying bar graph in xcode. have tried cpgraph , stuff around out of date , need xcode 4. newb , that's why need help. here code: -(void)drawrect:(cgrect)rect { nsstring *s = textfield.text; value = [s intvalue]; nslog(@"%i",value); cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(context, 60); cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); cgfloat components[] = {0.0, 0.0, 1.0, 1.0}; cgcolorref color = cgcolorcreate(colorspace, components); cgcontextsetstrokecolorwithcolor(context, color); cgcontextmovetopoint(context, 400, value); cgcontextaddlinetopoint(context, 400, 100); cgcontextstrokepath(context); cgcolorspacerelease(colorspace); cgcolorrelease(color); } notice have changed 1 of point value "value". have done create uitextfield , want able write 500 in uitextfield , bar adjust itself. nslog tell me value equal 0 if, before building app manually e...

java - how can i open the calendar from my app? -

i building app android, dont need app have calendar part of it(plus defeat purpose), app allows user listen radio station, , needs option set event to(remember listen radio @ specific time), if app has own calendar event alarms go off if user has app open... pointless. have been looking , cannot find, there way use intent or else open google calendar or other calendar android might have? need put intent(/ other code) in listener have , looks private view.onclicklistener reminder = new view.onclicklistener() { @override public void onclick(view v) { // open calendar code goes here. } }; i dont need app pre-fill in field in calendar open it, leave rest user. welcome , thank you if want open calendar can use , intent either of these component names (you might have cater both if want support older phones) intent = new intent(); //froyo or greater (mind tested on cm7 , less froyo 1 worked depends on phone...) cn = new compo...

xslt - Passing a param for a apply-template select in xlst, .net -

i have following in xslt file: <xsl:param name="predicate" select="//event" /> <xsl:apply-templates select="$predicate" /> and works fine, i'd change param .net code. var args = new xsltargumentlist(); args.addparam("predicate", "", "//event[@valid]"); xmlviewer.transformargumentlist = args; but no matter pass in predicate, error "expression must evaluate node set." is there way pass xpath selector transform? args.addparam("predicate", "", "//event[@valid]"); you passing string stylesheet, stylesheet using predicate parameter node-set -- performs <xsl:apply-templates> on it. the solution evaluate xpath expression passing string. example, use select() method of xpathnavigator . pass parameter transformation resulting xpathnodeiterator .

casting - c++ union in multiple files -

i'm sorry long, little complicated explain. we had hand in homework following program (much simplified here): some type of structure (class/struct) representing physical block of data (just char[1024]) two types of logical partitioning of block for example: struct p { char[1024] } struct l1 { int num; char name[20]; } struct l2 { int num; char type[10]; char filler[400]; bool flag; } the obvious thing me have union union { p phy; l1 logi1; l2 logi2; } but problem part of specification (the part cut out simplify it) physical stuff in separate file logical stuff. so question is: there way add fields union (i assume not) or way have functions in 'physical' file accept 'logical' blocks , use them raw blocks? i hope clear. p.s. due , solved reinterpret_cast . wondering if there more elegant way. what can create 2 unions. long don't interchange them fine.

text - Handling carriage return/line feed in MATLAB GUI user controls -

i have matlab program developing in order image processing stuff , need use user control matlab gui user interface created ad-hoc. this user control list box , there insert text. problem not cannot put text there, can using call: set(handles.mylistbox, 'string', 'mystringtoprint'); well problem call not let me insert many lines in list box overwrite previous one. i wish find way let code insert new text in new line. should not difficult , simple pattern: texttoprint = 'my text add' oldtext = get(handles.mylistbox, 'string') %holding previous text here set(handles.mylistbox, 'string', [oldtext '\n' texttoprint]) %setting (no line feed printed) set(handles.mylistbox, 'string', [oldtext char(10) texttoprint]) %setting (this fails too) well ok , not raise error but, \n not work. not have new line... need to!!!! how should solve this? problem need print text in user control, not on matlab commandline (that simple d...

jquery - Rails & Javascript - How to mark something as viewed or read? -

how mark viewed when user clicks on row. here example trying explain: http://www.dba.dk/dyr/hunde-og-tilbehoer/racehunde/race-labrador/ try click on row , go back. see row marked check sign. know have seen it. how create it? you're looking save ajax history state. 2 amazing rails , javascript tutorials can found here : http://railscasts.com/episodes/246-ajax-history-state http://railscasts.com/episodes/175-ajax-history-and-bookmarks the first link reference second. from ryan bate's website | railscasts.com /* application.js */ if (history && history.pushstate) { $(function() { $("#products th a, #products .pagination a").live("click", function(e) { $.getscript(this.href); history.pushstate(null, document.title, this.href); e.preventdefault(); }); $("#products_search input").keyup(function() { $.get($("#products_search").attr("action"), $("#products_se...

jQuery: how to respond to the click event of an anchor tag of a specific class? -

i have table has column contains links. each cell in column contains 2 links: view play when click 'play' link, want display alert box. has assigned play links same class 'play' my script looks this: $(document).ready(function(){ $('a.play').click(function(){ alert('i clicked'); }); }); i know script above wont work, because there more 1 element matches expression. have tried everything, including using $(this) try clicked element - still doesn't work. have a.play links pop alert when clicked? btw, if type $('a.play') in ff console, elements correctly selected know selectors correct. [edit] corrected typo in above snippet. comments have got far, seems code above should work. here further detail then. tried keep things simple prevent people getting distracted possible red herrings, seems further information required - possible there may clash between of plugins using on page (even though there no reported error...

jquery - Dealing with huge data in select boxes -

hi using jquery , retrieving "items" 1 of mysql tables. have around 20,000 "items" in table , going used search parameter in form. can search "purchases" contain "item". now need them able select "item" drop down list, takes pretty long populate drop down list 20,000 "items". wondering if there jquery plugin out there supports pagination drop down boxes autocomplete. that way user can either start typing first few letters have list filtered, or click on arrow , see maybe 20 items, , last "please click more". i open other suggestion dealing huge dataset , populating html select boxes said dataset. there might multiple select boxes on search page user can select "item" or "customer" or along lines , click on "search". with dataset large it's time use ajax... check out these autocomplete plugins: http://www.pengoworks.com/workshop/jquery/autocomplete.htm and ...

python - Single Django model, multiple tables? -

i have several temporary tables in mysql database share same schema , have dynamic names. how use django interface tables? can single model draw data multiple tables? you could, believe, make factory function return model dynamic db_table . def getmodel(db_table): class myclass(models.model): # define usual ... class meta: db_table = db_table return myclass newclass = getmodel('29345794_table') newclass.objects.filter( ... edit: django not create new instance of class's _meta attribute each time function called. creating new instance _meta dependent upon name of class (django must cache somewhere). metaclass can used change name of class @ runtime: def getmodel(db_table): class myclassmetaclass(models.base.modelbase): def __new__(cls, name, bases, attrs): name += db_table return models.base.modelbase.__new__(cls, name, bases, attrs) class myclass(models.model): __metaclass__ = myclassmetaclass class m...

mysql - C# homepage related question. (Request.Querystring["id"]) -

i working on homepage guild come , running in rift in near future, trying finish homepage fast possible. anyway! program homepages in vb.net , program c# when program applications. become better @ c# choose program homepage in c#. so heres problem, trying make foreach pulls out database stuff related id in addressbar, if address bar says "showtopics.aspx?id=1" in table in database has number 1 (i use field called fldovertopicid when adds new under topic overtopic gets same number overtopics id.) gets pulled out. though problem seems doesent work vb.net programming does. so heres code: in code give method name when write name later in code knows that, thats supposed do. can see ive put 'where fldovertopicid=" + id;' tell code want use fldovertopicid mediator code knows when addressbar number matches fldovertopicid supposed pull out same number. public datatable getundertopics(int id) { string strsql = "select fldid, fldtopicname, fld...

multithreading - Emit signals or post events from QRunnable -

is emitting signals inside qrunnable::run() right thing do? need inform gui thread image processed qrunnable done. using qthreadpool / qrunnable because need able add new tasks pool while there tasks in already. find kind of hard qtconcurrent , qfuturewatcher . the qrunnable using qobject created in run() connect target qobject , emit signals. if emitting qrunnable not thing, possible post events there? yes, emitting signals , posting events fine things in qrunnable::run() because both thread-safe. signals , events handled properly, qobjects must have correct thread affinity. see threads , qobjects more details.

interface - question on basic oops concepts -

i want find answer question let a parent class b,c child classes. now create objects follows, a o1 = new a(); b o2 = new b(); c o3 = new c(); a o4 = new b(); b o5 = new a(); c o6 = new b(); from these create errors , why.. got confused lot because 6 know error because b may have specialized variables , 7 possible , 8 not possible. if i'm wrong please correct me , also, a o7 = o4; b 08 = o5; kindly suggest me right answers , explanations , give me links tutorials kind of puzzles. assuming objects of pointer types- 1. *o1 = new a(); // correct 2. b *o2 = new b(); // correct 3. c *o3 = new c(); // correct 4. *o4 = new b(); // pointer derived class type-compatible pointer base class. casting acts default. 5. b *o5 = new a(); // wrong because other-wise relationship of above comment isn't true. though there separate concept called down-casting isn't valid here. 6. c *o6 = new b(); // wrong : c, b has no hierarchial relationships 7....

iphone - what is diffrence in this code with mainbundle and without? -

hello see new code me ,like push tw *obj =[[tw alloc]initwithnibname:@"tw" bundle:[nsbundle mainbundle]]; normally write code this tw *obj =[[tw alloc]initwithnibname:@"tw" bundle:nil]; what difference in bundle ? there no difference in case. passing nil initwithnibname:bundle: has special meaning. if parameter nil, means implementation should use [nsbundle mainbundle] .

java - Recursive toString() method in a binary search tree. What is the time complexity for this? -

i'm beginner in java , looking help. so i've made binary tree in java, , i'm supposed implement method sorts elements in order , convert them string. it's supposed ex. "[1, 2, 3, 4]". used stringbuilder in order this. my code method looks loke this: /** * converts nodes in current tree string. string consists of * elements, in order. * complexity: ? * * @return string */ public string tostring() { stringbuilder string = new stringbuilder("["); helptostring(root, string); string.append("]"); return string.tostring(); } /** * recursive method tostring. * * @param node * @param string */ private void helptostring(node<t> node, stringbuilder string) { if (node == null) return; // tree empty, leave. if (node.left != null) { helptostring(node.left, string); string.append(", "); } string.append(node.data); if (node.right != null) { strin...

internet explorer - Image Submit Not working in IE -

i have following code submitting form <div class="free-download"> <input name="method_free" value="<tmpl_var lang_free_download>" type="image" src="images/free-download.png" alt="<tmpl_var lang_free_download>" /> </div> it's working fine in firefox, in internet explorer loads same page reason, ideas? thanks try form attribute in input tag. <input type="image" form="(id of form belongs to)"> sometimes inputs can lost in layouts.

Graphics in Visual C++ -

what header file should include use graphics in visual c++? use visual studio 2010. thank in advance! "graphics" broad subject. native win32 applications not require libraries low level (ie write lot of code yourself). found this website useful. can find others searching "win32 tutorial". need include "windows.h" , possibly "windowsx.h" this. two main competing apis (application programming interfaces) directx , opengl. can search them used graphics , should resources , tutorials. these 2 may need libraries can internet (just search it). directx headers, vary on version of directx use , opengl require "gl/gl.h" , possibly others depending on want do.

Showing Loading screen during REST service request in android app? -

currently here following, app launched, have send request rest service, take little time , thought of showing loading screen, in oncreate() of activity , first thing show loading screen(progress dialog) , , kick off background activity using asynctask , i.e. requesting rest service , onpostexecute() close dialog , setcontentview(myxml); , update ui . can approach improved ? problem faced , sometimes , garbage collector may start(due various reasons) , app hangs @ loading screen forever , because of garbage collector , request rest service not sent , because of wake call comes , rest disaster , force close. but forceclose doesnot come fast , may because of gc. cannot go , stuck in loading screen. thing can @ point come home. after if come app still loading , approach seems bad design. whats right approach ? if expecting rest call take significant time, maybe should consider using service instead of async task. why? because on every orientation change, activity ...

Datatable -filter records with linq based on some internal index -

i have datatable plenty of records. , have range lowerrange = 10 , upperrange = 200 . i want pull records starting @ row 10 till row 200. now i don't want add new index based column datatable. there way of linq, can pull set of rows based on internal datatable index? guess, datatable must maintaining row index implicitly. please suggest. well, can use: var records = table.asenumerable().skip(10).take(191); that use "natural" order of datatable. you'll need make sure datatable being populated in useful order though.

variables - what is this in C++? -

int* i; int * i; int **i; i know int *i; represent pointer variable spacing doesn't make difference, first 2 identical. int** i; is pointer pointer int. for example, if i held pointer value, mean in memory starting @ address there pointer, time directly int , , if followed address then you'd find actual int number value. int an_int = 3; int* p = &an_int; int** pp = &p; this forms chain ala... int** pp = &p ------> int* p = &an_int ------> int an_int = 3

java - Getting errors from deleted class -

i deleted class netbeans spring application, holds method throw exception. removed jars attached class. when run application, tomcat log still shows errors deleted class, timestamped currently. shall call ghostbusters? logically if of class referring deleted class should throw classnotfound exception, if getting error in deleted class means, war have built not updated. try clean , rebuild war. stop tomcat. delete temp directories created tomcat previous runs. start tomcat. and before deploying war check in war deleted class should not there.

javascript - Says "Expecting more source characters" -

that code below gives error "expecting more source characters" may please me on issue. thanks cengiz yücel web developer form turkey <script type="text/javascript"> $(document).ready(function () { $("a#adevam").hover(function () { $("div#sekmebtn").css({ 'background-image': 'url(images/sekmebutondevam.jpg)' }); }, function () { var cssobj = { 'background-color': '#ddd' } $("div#aa").css(cssobj); }); </script> "expecting more source characters" indicates line that's not terminated , there one. var cssobj = { 'background-color': '#ddd' } needs semicolon.

Yii, ajax, Button. How to prevent multiple JS onclick bindings -

(first of english not native language, i'm sorry if i'll mistaken). i've created yii web app input form on main page appears after button click through ajax request. there "cancel" button on form makes div form invisible. if click "show form" , "cancel" n times , submit form data request repeating n times. obviously, browser binds onclick event submit button every time form appears. can explain how prevent it? thank you! i've had exact same problem , there discussion in yii forum . this happens because returning ajax results " render() " instead or renderpartial() . adds javascript code every time activate ajax buttons. if active triggered twice. solution use renderpartial() . either use render first time , renderpartial() , or use renderpartial() start make sure " processoutput " parameter set true first time.

objective c - SearchBar programming in iPhone/iPad -

i have data this...(all data comes .plist file...) searching array - ( { firstname = "ramesh"; lastname = "bean"; empcode = 1001; }, { firstname = "rohan"; lastname = "rathor"; empcode = 102; }, { firstname = "priya"; lastname = "malhotra"; empcode = 103; }, { firstname = "mukesh"; lastname = "sen"; empcode = 104; }, { firstname = "priya"; lastname = "datta"; empcode = 105; } ) i want implement search data array on basis of firstname (key). i able search data "firstname(key)" but after filtering data suppose clicked row( in data) displayed in tableview. navigate me new-controller information of particular employee (like: firstname,lastname,empcode). how can information? as gone throug...

How to connect to ExchangeServer from ASP.net (using c#)? -

this code use connect exchangeserver. account has 2 mailboxes assigned it. problem? don't bug nor result. can me, please? static void main(string[] args) { exchangeservice service = new exchangeservice(exchangeversion.exchange2007_sp1); service.credentials = new networkcredential( "{active directory id}", "{password}", "{domain name}" ); service.autodiscoverurl("user@domain.com"); finditemsresults<item> findresults = service.finditems( wellknownfoldername.inbox, new itemview(10)); foreach (item item in findresults.items) console.writeline(item.subject); } what error you're getting? edit: sorry, did. so findresults null or has count == 0 ? and what's curly braces in code: service.credentials = new networkcredential( "{active directory id}", "{password}", "{domain name}" );

Windows user home folder in C (MinGW) -

i'm trying port application written in c linux windows. at moment i'm done fixing 'hard' parts missing posix features , like. the application compiles, links , works on windows (except fork() stuff replaced windows service code later). the problem i'm having within msys shell works (this maps unix paths me). outside of msys shell won't work because ~ not available. i'm looking best way set windows user home within #ifdef stuff. i read %userprofile% somewhere doesn't seem work . use shgetknownfolderpath (vista+) or shgetfolderpath depending on windows version.

.net - passing data between 3 windows forms in visual studio using C# -

i have windows application has 3 forms : form1,2,3. want send text of textbox form2 form1 , same text form1 form3 , is, text form2 --> form1 --> form3 form 1, has 2 buttons , openform2, openform3. form2 has textbox form2_textbox, & button send_to_form1_button form3 has textbox received_from_form1_textbox now, on clicking button openform2 on form1 , form2 opens, a string entered in textbox form2_textbox of form2 , when button form2_button of form clicked, want form1 receive string value & stores in string receivefromform2 , and displays string value on form3_textbox of form3 . public partial class form1 : form { string receivefromform2a; public form1() { initializecomponent(); } public void method_receive_from_form2(string receivefromform2) { receivefromform2a = receivefromform2; form3 f3 = new form3(receivefromform2a); } private void openform3_click(object sender, eventargs e) { ...

php - insert checkbox values into database within a separate column of the query separated by commas -

i need problem i've been trying solve while (i'm new in php). have form several checkboxes values pulled specific table of database. managed display them in form, cannot insert values table connected specific page since there ony 1 column.i want enter selected values of checkbox single column separated commas. here's code: url <br><?php $query = "select url webmeasurements"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $url = $row[0]; echo "<input type=\"checkbox\" name=\"url\" value=\"$row[0]\" />$row[0]<br />"; $checkbox_values = implode(';', $_post['url']); } ?> <input type="submit" name="submit" value="submit"> </form> <?php if(isset($_post['url'])) { echo $url; foreach ($_post['url'] $statename) { $url=implode(',',$statename) } } $q="insert tab...

gridview - add column SELECT filter in grid menu -

i’m trying add select in column “sources” allow filter, code works well, i’m trying add filter without success, can point me in right direction? until know have: protected function _preparecollection() { $collection = mage::getresourcemodel('customer/customer_collection') ->addnametoselect() ->addattributetoselect('email') ->addattributetoselect('created_at') ->addattributetoselect('group_id') ->joinattribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left') ->joinattribute('billing_city', 'customer_address/city', 'default_billing', null, 'left') ->joinattribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left') ->joinattribute('billing_region', 'customer_address/region', 'defau...

php - use some twitter api to make people follow some account -

i have task make people follow account on twitter fill form on our website. can using twitter php api? or redirect or iframe job? thanks! joe just need read api bit, http://dev.twitter.com/doc/post/friendships/create

css - Web font hosted on another domain -

i know if it's possible host webfonts on domain, css hosted on amazon cloudfront , webfonts don't show up, fine when css in local. this style.css on cloudfront: @font-face { font-family: 'aller'; src: url('/app/files/fonts/allerdisplay-webfont.eot'); src: local('☺'), url('/app/files/fonts/allerdisplay-webfont.woff') format('woff'), url('/app/files/fonts/allerdisplay-webfont.ttf') format('truetype'), url('/app/files/fonts/allerdisplay-webfont.svg#webfontlz8nc4vc') format('svg'); font-weight: 900; font-style: normal; } the stylesheet hosted on cloudfront using subdomain: static.mydomain.com/style.css , webfont can downloaded : static.mydomain.com/app/files/fonts/allerdisplay-webfont.ttf unfortunately when stylesheet called mydomain.com doesn't load it. wondering if it's limitation or that. thanks should no problem absolute path url in style declaration. in ...

WPF - Copying resources on publishing -

i'm developing wpf application has reference of c# class library. c# class library has few xml files i'm copying output embed resources. when debug wpf application, xml copied debug folder of wpf , app runs properly. when publish application errors because application isn't finding resources. i must admit i'm introducing wpf, haven't understand yet process of publishing , installing application. those xml files should published vs in "aplication files" folder of published folder? if yes, i'm doing wrong? by way, i'm accessing files in code (of c# class library) appdomain.currentdomain.basedirectory thanks are using click once publishing? can define dependencies need , each 1 place must have.

playframework - RuntimeException occured : java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBRef -

i have been using play few months on ubuntu servers , on google app engine using siena module. have application on ubuntu server following versions: play framework - 1.1 morphia - morphia-1.2beta3 my code throwing strange error: runtimeexception occured : java.lang.runtimeexception: java.lang.classcastexception: java.lang.string cannot cast com.mongodb.dbref for line inside app/models/playlist.java: list items = playlistitem.filter("playlist", this).aslist(); "playlist" field in playlistitem , it's defined as: @required @reference public playlist playlist; the weird thing same application (i have code in source control , pull both machines) works on laptop not work on ubuntu server. know why may happening? you may want check this bug report . seems issue.

c# - An Explanation of MySqlBulkLoader -

can tell me mysqlbulkloader for, , how use it? some examples appreciated, please.. mysqlbulkloader class provided mysql .net connector . it provides interface mysql similar in concept sqlbulkcopy class / bcp sql server. basically, allows load data mysql in bulk. decent looking example can found @ dragthor.wordpress.com , there's example in mysql documentation .

sql - Using variables in Oracle script -

there complex query generates report. query has several sub queries generate 3-columns table different products. each sub query returns 1 row. returned rows need united. there 1 requirement. if there no result rows sub query need include corresponding product final report anyway, specify trades_count equal zero. i can achieve using set of variables. following code work in ms sql server: declare @product_name_1 nvarchar(100); declare @offer_valid_date_1 datetime; declare @trades_count_1 int; declare @product_name_2 nvarchar(100); declare @offer_valid_date_2 datetime; declare @trades_count_2 int; --product 1 select @product_name_1 = product_name, @offer_valid_date_1 = max(expiry_date), @trades_count_1 = count(deal_number) ( --data extractions several joins goes here.... ) temptable1 group product_name --product 2 select @product_name_2 = product_name, @offer_valid_date_2 = max(expiry_date), @trades_count_2 = count(deal_number) ( --data extractions several j...

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

Image
i have problem wpf binding. want bind list of months itemscontrol shows calendar control each month. each rendered calendar shows datetime.now,not bound datetimes. know why happening? this have far: the mainwindow.xaml <window x:class="calendarlisttest.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <itemscontrol x:name="calendarlist"> <itemscontrol.itemtemplate> <datatemplate> <calendar displaydate="{binding currentdate}" /> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </grid> ** place collection assigned itemssource** private void window_loaded( object sender, routedeventargs e ) { cale...

c# - How to get value from datagridview combobox? -

how value datagridview combobox after selected value changed? you can use: var value = datagridview.rows[0].cells[0].value note: supply correct row , cell number. or can if bound object listitem string value = datagridview.rows[rowindex].cells[columnindex].value.tostring(); if datagridview.rows[rowindex].cells[columnindex] datagridviewcomboboxcell && !string.isnullorempty(value)) { list<listitem> items = ((datagridviewcomboboxcelldatagridview.rows[rowindex].cells[e.columnindex]).items.cast<listitem>().tolist(); listitem item = items.find(i => i.value.equals(value)); }

vb.net - Filter on dataset clears all bound controls -

the following code works (rows filtered select expression), controls in datarepeater empty. when set .defaultview records return , controls have values. private sub checkbox_filterapplied_checkedchanged(byval sender object, byval e system.eventargs) handles checkbox_filterapplied.checkedchanged if checkbox_filterapplied.checked ' richtextbox_notes.databindings.add("text", dstransactions.tables("transactionheader"), "note") datarepeater_transactions.datasource = dstransactions.tables("transactionheader").select("applied = 0") datarepeater_transactions.refresh() else datarepeater_transactions.datasource = dstransactions.tables("transactionheader").defaultview end if end sub can't tell missing. refresh no help. i think problem because of datasource of textbox , datasource of datarepeater. i modified code slightly, please try it. works me. dim dt ne...

sql - Select AS not working in interbase -

works select payeeid, extract(weekday checkdate) dow, (bankcleared - checkdate) datediff master (bankcleared not null) order payeeid, dow, datediff adding datediff where - not work select payeeid, extract(weekday checkdate) dow, (bankcleared - checkdate) datediff master (bankcleared not null) , (datediff >= 1) order payeeid, dow, datediff you can use column aliases in group by, order by, or having clauses. standard sql doesn't allow refer column alias in clause. restriction imposed because when code executed, column value may not yet determined. try this select payeeid, extract(weekday checkdate) dow, (bankcleared - checkdate) datediff master (bankcleared not null) , ((bankcleared - checkdate)>= 1) order payeeid, dow, datediff for more info go through these links can use alias in clause in mysql? unknown column in clause

symantec - Cloning a Guardian Edge Protected Drive -

i need clone/ghost ge protected hard drive, running various issues. norton ghost seems freeze up, xxclone puts strange errors. realize entire drive encrypted, make difference cloning software? anybody have experience this? under linux can use dd command clone data 1 drive another. if don't have machine running linux, can download bootable cd e.g. http://www.sysresccd.org/main_page have dd , other useful commands dealing hard drives , data recovery.

How to rearrange the items of a list and the DOM with MooTools? -

i'm trying rearrange items of list: <ul> <li>1 <button><li> <li>2 <button><li> <li>3 <button><li> <li>4 <button><li> </ul> using mootools: document.getelements('button').addevent('click', function() { var tosort = new fx.sort(this.getparent(),this.getparent().getnext()); tosort.swap(); tosort = tosort.rearrangedom(); } when click button of first list element y expect: <ul> <li>2 <button><li> <li>1 <button><li> <li>3 <button><li> <li>4 <button><li> </ul> but get: <ul> <li>2 <button><li> <li>3 <button><li> <li>4 <button><li> <li>1 <button><li> </ul> what i'm doing wrong? thanks in advance depends effect want achieve. purpose of 'button'? move up? move top? move botto...

scripting - Getting Working Processes within IIS App Pools -

i looking way enumerate through virtual directories (windows server 2003) in app pool , diagnostic data (specifically workingset, private bytes, , virtual bytes). i've found plenty on how enumerate through server's app pools, , getting virtual directories within, need in order obtain diagnostic data? basically want add script grabs data monitoring app (nagios). have script grabs top 2 running worker processes on server, don't know app pool belong to. thanks. as you've discovered, it's two-step process: need resource utilization every worker process, , need know app pool corresponds each worker process. you've figured out first part. here's how other part: in windows server 2003, there's command-line script available in windows server 2003 called iisapp.vbs . see documentation more details. output command-line tool this: w3wp.exe pid: 2232 apppoolid: defaultapppool w3wp.exe pid: 2608 apppoolid: myapppool simply parse output scrip...

algorithm - Very basic radix sort -

i wrote simple iterative radix sort , i'm wondering if have right idea. recursive implementations seem more common. i sorting 4-byte integers (unsigned keep simple). using 1-byte 'digit'. have 2^8=256 buckets. sorting significant digit (msd) first. after each sort put them array in order exist in buckets , perform next sort. end doing 4 bucket sorts. seems work small set of data. since doing msd i'm guessing that's not stable , may fail different data. did miss major? #include <iostream> #include <vector> #include <list> using namespace std; void radix(vector<unsigned>&); void print(const vector<list<unsigned> >& listbuckets); unsigned getmaxforbytes(unsigned bytes); void merge(vector<unsigned>& data, vector<list<unsigned> >& listbuckets); int main() { unsigned d[] = {5,3,6,9,2,11,9, 65534, 4,10,17,13, 268435455, 4294967294,4294967293, 268435454,65537}; vector<unsigne...

Literal HTML in Django without using a variable? -

i've got bunch of html: <div align="center" id="whatever"> <a href="http://www.whatever.com" style="text-decoration:none;color:black"> <img src="http://www.whatever.com/images/whatever.jpg" /> </a></div> i want output literal html in browser, i.e. display above user. (edit: unfortunately don't have access django variables in template, due quirks of system i'm working on, can't use {{ | escape }} . is there way this, either using django template tags or special html tag, without having html-escape hand? thanks! yup, use escape filter: {{my_html|escape}} edit : force_escape : {% filter force_escape %} ... html escaped ... {% endfilter %} or, python: from django.utils.html import escape escaped_html = escape(html_to_escape)

security - WCF wsHttpBinding securiy without SSL and certificate -

i want secure wcf service used on internet. there few light methods, performance not issue (message size). prefer port 80 (web) firewall issues tcp binding not preferred. ssl not option in case. as researched wshttpbinding messagelevel security best choice scenario. configured service , client can receive data. when inspect service wcftestclient.exe , invoke service, can see soap message xml in tool. request , response in plain text without encryption. there examples of using certificates @ service side, , username password @ client side. want username/password based security @ both sides cannot find example on web. is possible ? (if yes, please provide link) thanks it not possible. if want message level security (encryption, signing, authentication) on internet must use user name , password clients (provides client authentication) , certificate service (service authentication client , exchange of key encryption , signing).

glassfish - How can I get j_username on my index.jsp after successful authentication with j_security_check? -

i'm using j_security_check on login.jsp. server glassfish server 3. works, when user authenticated opens index.jsp. problem need j_username in index.jsp, couldn't find way of doing it. solutions found in java , need works jsp. any ideas? thank in advance! the involved request in jsp el available pagecontext#getrequest() . logged-in user available httpservletrequest#getuserprincipal() . username in turn available principal#getname() . so, <p>welcome, <c:out value="${pagecontext.request.userprincipal.name}" /></p> should do. using <c:out> way not necessary, useful case username contain special html characters malform html output < , > , " , on (which source xss attacks). <c:out> escapes them displayed literally instead of being interpreted part of html markup.

.net - Unicode symbols in iTextSharp -

i'm trying use unicode symbol in pdf file itextsharp . dim base basefont = basefont.createfont("c:\\windows\\fonts\\wingding.ttf", basefont.identity_h, basefont.embedded) dim wd font = new font(base, 12, font.normal, basecolor.black) phrase = new phrase("q", wd) it's q.key in wingding. in pdf file it's not working. prints nothing char should be. where error? i did following , worked should. wingdings font appears in between 2 words square box bottom-right drop shadow. thing can't wingdings font embed , believe itextsharp implicit rule because assumed everywhere. tried wingdng2.ttf , embedded correctly. are maybe not adding phrase correctly? or opening on machine without wingdings maybe? ''//create new document dim doc new itextsharp.text.document(pagesize.letter, 20, 20, 20, 20) ''//store document on desktop dim writer = pdfwriter.getinstance(doc, new filestream(path.combine(my.computer.filesys...

html - Is it Possible to Style a Disabled INPUT element with CSS? -

i need style disabled <select> elements make them they're enabled. can help? ps. all-too-aware of downsides of doing sort of thing vis vis hci principles etc., requirement i've got if possible ... thanks. edit: @alexthomas' method works when elements disabled in html code unfortunately i'm doing disabling/enabling jquery: <select class='dayselector'> <option>monday</option> <option>tuesday</option> <!-- .... etc. --> </select> $(".dayselector").attr("disabled",true); $(".dayselector").attr("disabled",false); so selector: $(".dayselector") //works , gets selects and $(".dayselector option") //works , gets selects' option items but $(".dayselector [disabled='true']") //doesn't return anything. and `$(".dayselector [disabled='false']") //doesn't return anyt...

iphone - Android/ iOS how to determine small changes in distance using sensors? -

i have been doing bit of research, cannot seem find way determine small distances (centimeters , meters) using sensors in android or ios devices. bluetooth appears inaccurate , require more 1 device, gps works on larger variations in distance, , small variations in rotation seem make using accelerometer impossible. is there method unaware of allow me such thing? familiar calculus, using integrals determine distance based on changes in time , velocity/ acceleration not problem me, not know how determine things. thank you. there's no sensor in these devices able give desired accuracy without exterior help. if use case allows bit of external setup, here ideas: you use camera , computer vision calculate device movement. could, example, use artoolkit measure distance visual tag fixed wall. in close distances can pretty high accuracy (mm) using technique. another idea measure distance solid object, wall, emitting short audio signal using speaker , measure time unti...

javascript - Dynamicaly change the URL and id of a body via a link without refreshing page -

i trying dynamically change url displayed user , change id of body without refreshing page. function require similar flickr.com when click on image, pop-up appears. id of body has word appended it, , url of website has word appended it. an example be: http://www.flickr.com/photos/orangeacid/459207903/ there image there, if click on image url changes follows: http://www.flickr.com/photos/orangeacid/459207903/lightbox/ (this new page overlaying old one) before clicking on link body tag follows: document.body.classname = [document.body.classname, 'js'].join(' '); ... after clicking on picture changes to: document.body.classname = [document.body.classname, 'js'].join(' '); ... flickr uses yahoo's yui library , talking lightbox component, , history utility. there no all-in-one function, have build yourself, using library. note url : html5 adds new history api allows javascript change url ( pushstate ) without reloading p...

php - maintenance mode on root avoid addon domains -

problem 1 it little difficult have 3+ addon domain , folders in root.. example www/index.php rootsite.com www/example.com/index.php example.com www/example2.com/index.php example2.com remember above example.com , example2.com folders inside mains so when put rootsite.com maintenance mode.. using rewriteengine on rewritebase / rewritecond %{remote_addr} !^11\.111\.111\.111 rewritecond %{request_uri} !^/maintenance\.html$ rewriterule ^(.*)$ http://rootsite.com/maintenance.html [r=307,l] it diverst example.com example1.com root.com/maintanance.html kindly tell way avoid making example sites non maintanance mode.. not want .htaccess rules on root affect addon domain (in folders) problem 2 also other thing need pre made count down timer (in hours:min:sec) when site goes under maintenance mode... after countdown ends must divert rootsite.com.... can change .htaccess? mean when count down ends must change rule of .htaccess remove rule of maintanance mode. prob...