Posts

Showing posts from June, 2011

c# - 2D distance constraint -

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

c - Difference between Vector and Linked list ADT -

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

c# - cannot loop oo components in a usercontrol -

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

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

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

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

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

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

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

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

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

Presence autoload in Python 3.x? -

similar feature as: function __autoload(undefinedclass) { include 'library/'.undefinedclass.'.php'; } ?> python package = _init.py, bios=mbr, c++= stil or templates, php5 = autoload, python 3.x ? no, there no such feature, because don't need it. if want not import module until it's needed, import when it's needed. if want avoid circular imports, pretty same thing. there, question has answer. :-)

silverlight 4.0 - How to update a domain service when the .edmx file is updated? -

is possible update domain service? right delete service , add again stupid. there's no update support in ui, if you're returning whole entities there should no reason regenerate, should flow through when update edmx , rebuild project (to re-run codegen client).

Is there a library avaliable for compression in Javascript -

i looking sending data server in compressed format client(with ajax requests), , decompress data browser? there library this? i not looking compressing javascript files! thanks... edit: think question not clear enough, don't want compress html files, want store compressed lzma files or other compression format on server(like obj file), , need decompress them after got ajax. not simultaneous compression/decompression gzip. opening zipeed files after getting them javascript. your web-server (and browser) should capable of handling transparently using gzip. how setup depend on server using. checkout mod_deflate in apache or enabling gzip in nginx. the browser automatically decompress data before reaches xhr handler , can safe in knowledge data compressed as possible in transit.

iphone - what does this mean clone the GitHub repository? -

i trying use facebook app. read on developer.facebook.com install xcode install git clone github repository: git clone git://github.com/facebook/facebook-ios-sdk.git i have installed xcode , git. mean clone github repository: git clone git://github.com/facebook/facebook-ios-sdk.git , how can that. to clone repository means download whole code of repository. obviously, on mac, launch terminal, create folder , type git clone git://github.com/facebook/facebook-ios-sdk.git you download code.

Manage code snippets in Notepad++ -

Image
is there way manage code snippets backup database , code highlighting in notepad++? there plugin manage code snippets: snippetplus .net 3.5 required! code snippet , surround plugin notepad++. write snippet name , replace real code or select text , surround if,trycatch,table,div or whatever.will give hint if don't remember snippet name note latest version may shown, though have older version installed. reinstall ensure have latest version. author: rajesh kumar homepage: http://sourceforge.net/projects/snippetplus/ you can install notepad++ plugin manager, , activate dock clicking black m-like symbol in toolbar; select 1 of bundled snippets , paste editor double-clicking it. for example, if have visual basic file , need include try/catch block contains if-elseif-else structure, must follow these steps indicated in image: put cursor want new code snippet at, activate dock toolbar: open docked dialog marked in yellow. doubl...

jquery - Is is possible to display barcharts horizontally in Flot? -

apologies, i'm newbie @ flot. i'd display data in horizontal bar chart rather vertical bar chart flot seems default to. is possible in flot, and, if so, how do it? bars: { horizontal: true } api reference: http://flot.googlecode.com/svn/trunk/api.txt

GlassFish 3.1 won't start from Eclipse -

i'm using linux, , i've installed glassfish 3.1 outside of eclipse. starts fine asadmin start-domain. in eclipse helios i've installed latest version of glassfish tools, server adapter etc. i've added "server" instance external glassfish, when try start it, eclipse console says "waiting domain1 start ......" – more , more dots printed while wait several minutes. there's dialog saying "server glassfish 3.1 @ localhost failed start." at no point http://localhost:8080 responding. there no other errors messages can find. server log (glassfish/domains/domain1/server.log) prints long startup command, , then: feb 28, 2011 10:48:45 pm com.sun.enterprise.admin.launcher.gflauncherlogger info info: launched in 3 msec. the glassfish installation entirely stock, no applications loaded. works fine when start...

php - Why does empty expect T_PAAMAYIM_NEKUDOTAYIM when a non-variable is given? -

<?php define('foo', 'bar'); if (empty(foo)) { echo 'qux'; } http://codepad.org/g1tsk1c6 parse error: syntax error, unexpected ')', expecting t_paamayim_nekudotayim on line 4 i know empty() allows variables passed argument, why expect t_paamayim_nekudotayim (i.e. :: ) when give constant? the next logical thing parser wants :: because foo not variable. if (empty(foo::$bar)) { } is thing, works when empty() not passed variable. example evaluated empty(bar) parser assumes bar class name , expects static member variable.

delphi - How can I control the border size of a window? -

i've got forms use absolute positioning , pixels win7 adds "handles" enhance translucency screwing controls up. i'd take them back. tried using code in 1 of answers here: can make borderless application main window in windows, without ws_popup style? specifically answer goleztrol provided utilizing override in showform call setwindowrgn. code's behavior bit different under w7 xp, , in case can't effect i'm looking for. for standard tform in xp, quantity width-clientwidth = 8, , in win7, it's 16. i'd 8 pixels back. i'd height pixels while i'm @ it, though width more important. i think bad practice rely on border width of form, especially since end-user can change in control panel! clientwidth property there use instead of width . set former whatever like, , latter computed.

unpack dependecies once with maven dependecy plugin -

hi i've figured out explode zip file in project directory 1 time. mean if diretory exist not explode second time. here way today <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version>2.2</version> <executions> <!--import qooxdoo sdk , add target directory--> <execution> <id>extract-qooxdoo-sdk</id> <phase>process-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> ...

ruby on rails - Good practice for protecting methods -

being newbie ror developer i've been thinking of ways of protecting methods make sure correct user updating own content. here example of approach. would recommend cleaner way or better way of doing such tasks? # example controller class owner::propertiescontroller < owner::basecontroller def index end etc..... def update @property = property.find(params[:id]) # check correct owner check_owner(:owner_id => @property.owner_id) if @property.update_attributes(params[:property]) redirect_to([:owner, @property], :notice => 'property updated.') else render :action => "edit" end end def destroy @property = property.find(params[:id]) # check correct owner check_owner(:owner_id => @property.owner_id) @property.destroy redirect_to(owner_properties_url) end private def check_owner p = {} if p[:owner_id] != session[:owner_id] redirect_to([:owner, @property],...

c# - deserialize json string for multiple results -

i using json.net when go deserialize following json json cannot deserialize type list. json: {"postalcodes":[{"adminname2":"new york","admincode2":"061","admincode1":"ny","postalcode":"10001","countrycode":"us","lng":-73.996705,"placename":"new york city","lat":40.74838,"adminname1":"new york"},{"adminname2":"new york","admincode2":"061","admincode1":"ny","postalcode":"10019","countrycode":"us","lng":-73.985834,"placename":"new york city","lat":40.765069,"adminname1":"new york"},{"adminname2":"new york","admincode2":"061","admincode1":"ny","postalcode":"10021","countryco...

c# - How do I get Gridview underlying datasource? -

i have gridview in asp.net web application under framework 3.5. binding gridview list. inside grid there update , delete functionalities running fine. save functionality, decided extract list datasource , through loop insert new list database. when tried conventional way returned me null. i tried following ways retrieve list back. 1. list<myclass> list = (list<myclass>gv.datasource); 2. list<myclass> list = gv.datasource list<myclass>; 3. idatasource idt = (idatasource)gv.datasource; list<myclass> list = (list<myclass>)idt; but no luck, each time got null. you cannot retreive datasource once is bound , page served. have few methods available retain datasource though: store data before binding in session store data before binding in viewstate fetch data db or whatever data store retrieved originally. keep ongoing cache of changes stored somewhere else (eg session , viewstate , etc) i prefer stay away drag , drop useage ...

arrays - php timed (duration) display -

so want have array in .txt file separate lines , pull each line , display after duration... don't know if need mix ajax php or if can straight php. is foreach best way this? <?php $x=file("sayings.txt"); foreach ($x $value) { echo $value . "<br />"; } ?> where can implement duration.. there wait? like this: { echo $value . " "; wait 1000 //miliseconds } went javascript one.. here if want answer/code: javascript array timed service side solution server side : <?php $x=file("sayings.txt"); foreach ($x $value) { echo $value . "<br />";//send output flush(); //make sure it's outputted sleep(1); //sleep 1 second } ?> client side solution but, can use ajax call parameter (an index) return next index every call. can settimeout in javascript. <script type="text/javascript"> var arrayi...

haskell - Counting and filtering Arrow for HXT -

i'm trying parse xml, want filter , extract determinate number of children given node. example: <root> <node id="a" /> <node id="b" /> <node id="c" /> <node id="d" /> </root> and if execute arrow getchildren >>> myfilter 2 , nodes id "a" , "b". intuition gives should use state arrow keep track, don't know how that. i tried myself it's not want, doesn't elegant, , doesn't work. try run chain of arrows runsla , integer parameter initial state, , defining: takeonly :: iosla int xmltree xmltree takeonly = changestate (\s b -> s-1) >>> accessstate (\s b -> if s >= 0 b else nothing) but of course can't return nothing , need return xmltree. don't want return @ all! there's better way out there. can me? thanks time , help! it more idiomatic use combinators in control.arrow.arrowlist ...

ios - Strange BOOL behavior in tableView (When is 1 not equal to 1?) -

i'm trying convert existing app use core data. i've set entities, , using nsfetchedresultscontroller display data in table view. now, i'm populating database each time app launches. it appears working fine, aside 1 strange issue. entity has bool value, "showstarcorner" determines whether or not image of star should shown in table cell... so, call similar if statement when configuring each tableview cell: if (myobject.showstarcorner == [nsnumber numberwithbool:yes]) { // show star corner } but surprisingly results in star being shown on objects created on launch of app. (objects added on previous launches of app should showing star not) i added test, figure out wrong: if (myobject.showstarcorner == [nsnumber numberwithbool:yes]) { nslog(@"%@ == %@", myobject.showstarcorner, [nsnumber numberwithbool:yes]); } else if (myobject.showstarcorner != [nsnumber numberwithbool:yes]) { nslog(@"%@ != %@", myobject.showstarcorner, [...

iphone - UIWebview in UIScrollview with images, left most goes white -

uiscrollview x images frames next each other , work fine, scrolling, etc. there 1 uiwebview in scrollview subviews set hidden. when web page desired webview set frame of image (in page did load), image hidden , webview set not hidden. all working fine except when done image @ left position in scroll view, web view seems start display web page (after page did load event) goes white , it. web view , scroll view seems in bad state. trying hide web view , etc not work. happens left image, otherwise else seems working fine. fix right stop , start app. scrollview has been working fine , defined in ui editor. imageviews , webview defined @ run time. any comments on how fix this? if leftmost position ignored scroll view (does not make web view visible), works fine. sdk 4.x one tip docs: "you should not embed uiwebview or uitableview objects in uiscrollview objects."

android - Save Mapview as bitmap -

i trying save mapview bitmap image null pointer exception have checked post here couldnt find solution problem, code under: public class customview extends mapactivity{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mapview mapview = new mapview(this, "*************mapapikey****"); mapcontroller mc = mapview.getcontroller(); geopoint p = new geopoint((int) (36 * 1e6),(int) (36 * 1e6)); mc.animateto(p); mc.setzoom(20); mapview.layout(0,0,400,400); bitmap screenshot; mapview.setdrawingcacheenabled(true); screenshot = bitmap.createbitmap(mapview.getdrawingcache()); //this line gives error mapview.setdrawingcacheenabled(false); } //other map functions automatically included here } what want should able save bitmap on phone , use inanother activity. error log: 03-03 10:57:01.948: error/androidruntime(8303): java.lang.r...

windows - open command prompt in hidden mode through java -

i want open command prompt through java , perform task. want open command prompt in hidden mode. command = "cmd.exe /c start doxygen " + strdoxyfilepath; process p=runtime.getruntime().exec(command); please try following command start program minimized command = "cmd.exe /c start /min doxygen " + strdoxyfilepath; process p=runtime.getruntime().exec(command);

java - Junit method not found -

i'm trying build sample test class using junit framework. i've downloaded junit4.9b3. when try complie test class following error:- javac -cp ".;c:\documents , settings\user\desktop\junit\junit4.9b3\junit-4.9b3.jar" testsubscription.java testsubscription.java:10: cannot find symbol symbol : method asserttrue(boolean) location: class testsubscription asserttrue(s.pricepermonth()==100.0); ^ testsubscription.java:17: cannot find symbol symbol : method asserttrue(boolean) location: class testsubscription asserttrue(s.pricepermonth()==66.67); ^ 2 errors looks asserttrue not available junit javadoc mentions method. i'm using import follows import org.junit.*; import org.junit.assert.*; any ideas? you've imported types, not used static import make members available without qualification. if use: import static org.junit.assert.*; then should st...

powershell - Can Add-Type -AssemblyName be made to respect AssemblyFolders or AssemblyFoldersEx -

you can make non-gaced references show in visual studio add reference dialog putting assembly paths in 1 of following registry entries: [hklm|hklu\software\microsoft\.netframework\<version>\assemblyfoldersex\ [hklm|hklu\software\microsoft\.netframework\assemblyfolders\ the second version not work in vs.2010 , seems deprecated. there way add-type respect list? as far can tell cannot done. such opened feature request on connect allow in cases.

Socket Policy file for Flash/Java not being recieved by Flash -

i'm trying test policyserver listening on port 843 handles sending of policy files client can move onto connecting gameserver on different port. i'm able following outputs server: connection policyserver /192.168.1.66:2521 recieved: policy-file-request sending: xml policy connection gameserver /192.168.1.66:2522 recieved: policy-file-request even through send xml policy seems ignore , request 1 gameserver. have client/server being tested on same computer? isn't ports being different?

Maths help with exponentials -

evaluate (z x^-1 y)^5 y^5 ~~~~~~~~~~~~~~~~~~~~~~~ over x^-4 z^-4 how evaluate if x = 10, y = -3 , z = 3? step-by-step solution me understand it. numerator evaluates (z*y*x^-1)^5 * y^5 further rewriting ((z^5*y^5)*y^5)/x^5 denominator ((1/x^4)*(1/z^4)) final answer ((y^10)*(z^9))/x as per values (3^19)/10

my sql command within codeigniter is not working -

i tested function doesn't work , no query result produced. what's wrong im newbie. there ar alternatives? im trying create mini search engine. in advance. function search($terms) { $sql = "select * products name '%$terms%' or image '%$terms%' or code '%$terms'"); $query = $this->db->query($sql, array($terms, $terms)); return $query->result(); } to bind query data passed function, have following: $sql = "select * products name ? or image ? or code ?"; $this->db->query($sql, array($terms,$terms,$terms)); also in our posted code, remove parenthesis string $sql , binding 2 values, when query requires 3 try this: $sql = "select * products name ? or image ? or code ?"; $this->db->like('name', $terms); $this->db->like('image', $terms); $this->db-...

c# - How to initialize readonly item collection with resource in XAML -

suppose have control readonly items collection. can initialize collection using collection syntax: <something> <something.items> <item /> <item /> </something.items> </something> suppose have collection in resources , want initialize control it: <window.resources> <itemcollectionclass x:key="collection"> <item /> <item /> </itemcollectionclass> </window.resources> how it? <something items="{staticresource collection}" /> doesn't work since it's trying set collection instance, not initialize it. you can initialize collection objectdataprovider: <window.resources> <itemcollectionclass x:key="collection"> <item /> <item /> </itemcollectionclass> <objectdataprovider x:key="..." objecttype="{x:type local:something}"> <objectdata...

vb.net - How to create & write data in the XSLT file? -

i want create xslt file programmatically using vb.net. & want write nodes & subnodes in file . how can this? can me in resolving problem? thanx..... usually when requirement arises, xslt want generate has 95% fixed (predictable) content, , 5% dynamic content. in case best approach put fixed content in xml file, , transform using xslt generate dynamic content. there other cases content dynamic, example when want generate lots of template rules conditions defined in input file. in case generating stylesheet using xslt useful technique.

Check if a time in a timezone is elapsed in php? -

here's time entered user cdt 2011-02-01 16:30:00 how know if time passed in php? thanks $usertime = strtotime('cdt 2011-02-01 16:30:00'); if (time() > $usertime) echo 'time passed';

ioc container - Setting up structure map in a c# console application -

i'm getting error: structuremap exception code: 202 no default instance defined pluginfamily my setup looks like: console.writeline("structure map"); setupsm sm = new setupsm(); sm.setup(); isomething = objectfactory.getinstance<isomething>(); console.writeline("something.howmanythings: " + something.howmanythings("asdf")); public class setupsm { public void setup() { var c1 = new container(config => { config.scan(scan => { scan.thecallingassembly(); scan.withdefaultconventions(); }); }); var c2 = new container(x => { x.for<isomething>().use<somethingone>(); }); } } this first try @ using structure m...

svn - Subversion refactor trunk and still be able to merge changes to old branches -

what best practices in situation refactor trunk in svn cannot apply refactor older branches, yet still need able svn merge bugfixes trunk branches? to ask question more (if helps - if can answer above, feel free ignore): we want move maven going forward, still need maintain old releases - cannot touched except customer sanctioned changes , bugfixes. so, need refactor our folder structures around in trunk per maven - src/main/java, src/main/webapp etc (its wtp project - src, webcontent instead of above). but going forward, still need able svn merge older branches still in old folder structure. is possible? best practices? i know can apply changes trunk, , apply changes branch manually, result in lot of pain developers want avoid. apologies if answered or obvious (i have thought be, feel i'm asking obvious question!) thanks in advance, justin if move things around can still use svn merge, not straight on. svn merge not track moved files. at lowest level...

Format a String in C++ with the same convenience as String.format() in Java 5 / 6? -

is there common function available able sprintf type string formatting without having supply fixed size buffer, returns string class instance? i know stringstream doesn't want, i don't want hard code position of tokens in output statement requires. i want able define pattern sprintf lets you, without c baggage , in more idiomatic object oriented c++ manner. maybe function sprintf using stringstream , produces string object? along line of convenience of string.format() in java or equivalent string formatting syntax in python. the boost format library : the <boost/format.hpp> format class provides printf -like formatting, in type-safe manner allows output of user-defined types.

Android widget refresh not working -

my widget should refresh textviews every day @ 0:00. in widget_provider.xml set android:updateperiodmillis="1000" read minimum update period 30 minutes , have use alarmmanager this. want alarm triggers refresh every day @ 0:00. updateservice.class handles refreshing (setting texts textviews based on date. class not called until around half hour after midnight) in public void onupdate(context context, appwidgetmanager appwidgetmanager, int[] appwidgetids) method using code: intent intentn = new intent(context, updateservice.class); pendingintent pendingintent = pendingintent.getbroadcast(context, 0, intentn, pendingintent.flag_update_current); calendar calendarn = calendar.getinstance(); calendarn.settimeinmillis(system.currenttimemillis()); calendarn.add(calendar.hour_of_day, 20); calendarn.add(calendar.minute, 44); calendarn.add(calendar.second, 5); alarmmanager alarmmanager = (alarmmanager)context.getsystemservice(context.alarm_service); alarmmanager.setre...

symbian - ClassNotFoundException on app startup (on device) -

i have been able run app once on device (n8). since classnotfoundexception when launch it. goes this: classnotfoundexception: com.greencod.pinball.nokia.pinballmidlet @ java.lang.class.forname @ ...rtcldc.loadapplicationclass @ ...rt.jvm.loadapplicationclass @ ... invoker.handlestarrequest @ ...l.rt.midp.midleinvoker.run @ java.lang.thread.run note app runs fine on emulator. also, first time ran througth debugger in eclipse. debugger or plain install doesn't produce app can run. new nokia development, must doing stupid, don't know :) using symbian^3 sdk 0.9. to application on phone, click 'create package' manifest view, build jar/jad files 2 targets: symbianemulator , symbiandevice, installed scanning sdk folder. after have tried uploading file device dropping in install folder, using debuger in eclipse , ovi program on computer. phone configured accept unsigned application. i quite lost , welcome. additional info eclipse building jad m...

php - display tags one by one -

hi have tags in database in row called tags. separated commas. for example, stored in database tag1,tag2,tag3 . i want retrieve them database , display them 1 one separately , before displaying each tag, want link url. here's doing far, $keywords = strip_tags($blog_query_results['keywords']); //retrives tags database echo wordwrap(stripslashes($keywords), 65, "<br>",true); // prints tag1,tag2, , on. while printing them want link tag1, tag2, , tag3 different urls. if have string : $tags = 'tag1,tag2,tag3'; you can use explode() function array of tags : $arr = explode(',', $tags); and, then, iterate on array, build link each item -- typically, using foreach() : foreach ($arr $t) { echo '<a href="...">' . htmlspecialchars($t, ent_compat, 'utf-8') . '</a><br />'; } sidenote : database's design bit wrong, if store more 1 information in single field. ...

Best way to implement Entity with translatable properties in NHibernate -

consider following class (simplified in order focus in core problem): public class question { public virtual string questionid { get; set; } public virtual string text { get; set; } public virtual string hint { get; set; } } and tables: question - questionid ((primary key, identity column , key) - code questiontranslation - questiontranslationid (primary key, identity column; not relevant association) - questionid (composite key element 1) - culturename (composite key element 2) (sample value: en-us, en-ca, es-es) - text - hint how can map question class text , hint properties populated using current thread's culture. if thread's culture changed text , hint properties automatically return appropriate value without need question entity reloaded. note i'm outlining relevant class , properties business side. i'm totally open new class or property needed achieve desired functionality. edited reflect changed answer: public class questi...

objective c - iPhone - Image in UIImageView does not shows up into simulator -

i have imported png pictures project, , interfacebuilder, add uiimageview view. set image property 1 imported (selecting dropdown menu). shows up. run simulator ib, , shown view except image. what's problem ? didn't else or more said before. the project default viewbased project. @oliver wont image in simulator if running ib. should run simulator xcode. image in xcode project folder not in .xib file. ps. if run iphone simulator ib run .xib file , show contents added in xib file, labels textfileds. wont show image. if want see if image view proper or not change background color of uiimageview other default , run color have selected ib in simulator. pss. click on xib file , in option select open source file. check out how xib files made.

Validate form with jQuery on submit -

i have function when click on submit button: $('#signup-button').click(function(event){ var username_check = validateusernamefield(); var email_check = validateemailfield(); var name_check = validatenamefield(); var birthdate_check = validatebirthdatefield(); event.preventdefault(); if(username_check && email_check && name_check && birthdate_check) { alert('lol'); var formdata = $('#fonykeraddform').serialize(); $.ajax ({ type: 'post', url: '<?php echo $html->url('/fonykers/add',true); ?>', data: formdata, datatype: 'json', success: function(response) { $( "#confirm-dialog" ).html(response.msg).dialog({ autoopen: fa...

c++ - class with Multithreaded member function -

i have class trying convert of member function run in different threads. while program complies without problem, crashes when trying read image buffer(which updated different thread). seems problem cause when argument passed incorrectly in _beginthread. the following snippet of code should explain more trying do. trying accomplish have member function "fillbuffer" fill image buffer while rest of program doing else including reading same image buffer @ same time. any syntax appreciated. const int maximgbuffersize = 5; class myframe : public wxframe { public: // constructors myframe(const wxstring& title); private: static vector <iplimage*> imgbuffer; void changewp(wxcommandevent&); void fillbuffer(); void fillbufferfun(); static void __cdecl getimgfrombuffer(void *); static void __cdecl pushimgbuffer(void...

jstl - how to access array list in jsp , if i pass bean -

i new jstl. how can use jstl <c:foreach> inside jsp if pass below sample bean class b{ private string value=""; private arraylist arrayvals; public string getvalue(){ return value; } public string getarrayvals(){ return arrayvals; } } i pass bean "b" only. tried below, jsp not compiled. please me. <c:foreach items="${b.getarrayvals}" var="book"> <c:out value="{book.title}"/> </c:foreach> first of all, getarrayvals() should spelt getarrayvals() , , should return list, not string, obviously. now suppose servlet or action sets attribute "b" of type b : request.setattribute("b", thebinstance); and forwards jsp, can access list in attribute "b" this: ${b.arrayvals} you must refer b instance name of request attribute, not class name. if name attribute foo, use must use ${foo.arrayvals} . print tostring of list. i...

mysql - Count only null values in two different columns and show in one select statement -

i want count null values in specific column , null values in specific column, want result have both of these results shown in 1 table. here have far: select count(*) 'column1count', count(*) 'column2count' table1 column1 null , column2 null please help this should work : select (select count(*) table1 column1 null) 'column1count', (select count(*) table1 column2 null) 'column2count';

android - Put Layout at bottom and add scrollbar -

i have 3 relative layouts in may app, on above another. <relativelayout_1><checkbox></checkbox></relativelayout> <relativelayout_2></relativelayout> <relativelayout_3></relativelayout> first @ top, , third @ bottom. when click on check box in first layout, second layout visible/unvisible. how achive see third layout @ bottom , put scrollbar @ second when visible ? ( second have lot off content when visible, third layout vanished ). try <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#888888" android:id="@+id/relativelayout1"> <relativelayout android:layout_height="wrap_content" android:id="@+id/...

javascript - Restrict tabindex focusing to a section of the page -

situation: i have webpage opens modal windows (light boxes) contain forms user can input data. users navigate using keyboard, tabbing 1 field next. problem: when modal window opens, window active, rest of page not accessible using mouse, elements can reached tabbing out of modal window. question: how can restrict movement using tab button elements within form window? the thing can think of using javascript set tabindex=-1 on form elements (and other focusable elements) when modal window opened , set tabindex values previous values when modal window closed. there simpler/better way? no, it's way. find elements have tabindex greater -1 † , don't belong modal. create array &ddagger; , fill references each element along original tabindex . set each element's tabindex -1 can no longer receive focus keyboard. when modal dialog closed, iterate on array , restore original tabindex . here's quick demo: function isdescendant(anc...

prolog - Appending a list to a list of lists recursively -

the problem i'm trying solve follows: i'm given sorted list must pair first , last items in list. must pair 2nd , (last-1) items in list until list either empty or 1 element remains. must return list of pairs. the steps decided take problem first check if list's length greater 1. if wasn't, means have list of 0 or 1 elements. then first , last items in given list, delete them list, pair them, , recursively call same predicate on new list. once i've gone way down 0/1 items, pop , append them return list. the problem i'm having when try append pair l = [first,last] return list, errors out. code listed below. t input list. first/2 gets first item in list. pair/3 strips away info p1 , p2 , creates l = [p1,p2] . getmatches(t,k,returnlist) :- ( length(t,val), val > 1, first(t,p1), last(t, p2), delete(t,p1,g), delete(g,p2,h), pair(p1,p2,l), getmatches(h,k,returnlist), append(l,k,returnlist...

Port simple C++ to PHP code -

i need similar in php: struct msg_head { unsigned char c; unsigned char size; unsigned char headcode; }; struct get_info { struct msg_head h; unsigned char type; unsigned short port; char name[50]; unsigned short code; }; void example(get_info * msg) { printf(msg->name); printf(msg->code); } i created general purpose php struct class, emulate c-structs, might useful you. code , examples here: http://bran.name/dump/php-struct example usage: // define 'coordinates' struct 3 properties $coords = struct::factory('degree', 'minute', 'pole'); // create 2 latitude/longitude numbers $lat = $coords->create(35, 40, 'n'); $lng = $coords->create(139, 45, 'e'); // use different values name echo $lat->degree . '° ' . $lat->minute . "' " . $lat->pole;

templates - How can I create a sparse matrix as a list of lists? (C++) -

the question is: possible create sparse matrix using following sparse list implementation? in special, using class template class template (sparselist*>)? i've created class template named sparselist can add elements in whatever index want. i'd use create sparsematrix class template. tried following... //sparsematrix.h template <typename t> class sparsematrix { public: sparsematrix(); private: sparselist<sparselist<t>*> *matrix; }; template <typename t> sparsematrix<t>::sparsematrix() { matrix = new sparselist<sparselist<t>*>(); } but when try instantiate on main... int main() { sparsematrix<int> *matrix; matrix = new sparsematrix<int>(); //without line compiled normally. return 0; } i got following error... in file included src/main.cpp: sparsematrix.h: instantiated 'sparsematrix<t>::sparsematrix() [with t = int]' main.cpp: instantiated here...

c# - Is this good design? -

i creating text editor. text-box control subclass of textbox called editor . main form, mainform , has instance of editor . when mainform wants to, say, load text document, calls editor.loaddocument(string path) . editor.loaddocument calls document.load(string path) . the same kind of thing happens save: mainform --> editor.savedocument --> document.save . it seems editor acting middleman unnecessarily here, i'm thinking of letting mainform access document directly: editor.document.load(path) . editor still create , maintain document ; provide direct access it. note create bidirectional association: editor have document , document have editor ( document uses editor.text , subscribes editor.textchanged ). i have 2 questions: is design? do bidirectional associations create slowdown pertaining garbage collection when app exits? you need read patterns such model-view-controller. generally, ui should activate operations directly on...

iis - Split ASP Classic and ASP.NET into separate App Pools -

is possible run asp.net , asp classic in separate app pools? asp classic pages mixed within same asp.net application , sub folders. basically, have site , run asp.net portion in own app pool , asp classic in separate app pool. intent run asp.net in "web garden" configuration; can not if asp.net , asp classic in same app pool, due fact classic portions rely on session variables in process. we have considered rewriting classic self contained in 1 directory, , switching sql-based session storage classic. determined easier attempt split app pools, these 2 options require significant time investment. thank assistance! that's not possible afaik, can configure iis application pool application.

mysql - PHP recursive menu in HTML list structure -

here html structure how should like <li><a href="#" class="menulink">dropdown one</a> <ul> <li><a href="#">navigation item 1</a></li> <li> <a href="#" class="sub">navigation item 2</a> <ul> <li class="topline"><a href="#">navigation item 1</a></li> <li><a href="#">navigation item 2</a></li> </ul> </li> <li> <a href="#" class="sub">navigation item 3</a> <ul> <li class="topline"><a href="#">navigation item 1</a></li> <li><a href="#">navigation item 2</a></li> <li> ...