Posts

Showing posts from February, 2012

c# - Find the content of a TextBox inside a DataTemplate with multiple rows -

i have code: <stackpanel> <itemscontrol itemssource="{binding position}"> <itemscontrol.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition width="2*" /> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="80" /> </grid.columndefinitions> <textbox grid.column="0" text="{binding name}" margin="5" /> <textbox grid.column="3" text="{binding id}" margin="5" /> <button grid.column="4" content="x" click="delete" /> </grid> </datat

android - How to put pin on google map permanently that show our address? -

i want put info window on marker 1 arrow button , text , want click event of arrow in google maps android api v2. if using google maps sdk android can use googlemaps.setmylocationenabled(true) show location permanently on map. please see at sdk reference more infos or read this question .

exception - ElasticSearch 0.90.2 StreamCorruptedException on asking port 9300 -

i've unpacked elasticsearch-0.90.2.zip on windows xp, , started bin/elasticsearch.bat. i've set java_home c:\program files\java\jre7, problem @ first run. i'm trying connect google chrome 27.0.1453.116. according elasticsearch.yml, "elasticsearch, default, binds 0.0.0.0 address", 0.0.0.0:9200 responds 108 (net::err_address_invalid). localhost:9200 or 127.0.0.1:9200 responds correctly: { "ok" : true, etc. localhost:9300 responds 324 (net::err_empty_response), , displays streamcorruptedexception in console window: [2013-07-25 10:42:30,419][warn ][transport.netty ] [happy birthday] exc eption caught on transport layer [[id: 0x478ae9b7, /127.0.0.1:1627 => /127.0.0.1 :9300]], closing connection java.io.streamcorruptedexception: invalid internal transport message format @ org.elasticsearch.transport.netty.sizeheaderframedecoder.decode(sizeh eaderframedecoder.java:27) @ org.elasticsearch.common.netty.handler.codec.fra

sql - Identify Digits in text field in MS Access -

how possible identify values text in text field for instance; col1 thy1 d881 d282 rm01 d114 kaar 5555 kaar kaar expected results results digits digits digits digits digits kaar digits kaar kaar i tried below, doesn't work though select iif(tab1.col1 "[!0-9]", tab1.col1, "with digits") results tab1 please clarify thanks select col1 tab1 col1 not "%[0-9]%" you should harness power of "where" clause. update: since want preserve order , replace improper values "with digits", correct clause should this: select iif(tab1.col1 "%[0-9]%", "with digits", tab1.col1) results tab1; note "%" signs, make sql match 0-9 position of tab1.col1 .

python - How does CouchDB handle updating views after I update a particular document? -

i have database of size 200mb,and around 10 views written on it. gives me view file occupies around 3-4gb on disk all docs in db updated once everyday interval of minute between each update,so number of documents constant.(number of docs=number of minutes in 24 hours) when update doc it's new revision , compact db immediately(to delete old rev) after,what happens view file?do values in b-tree updated new values,or there new entry on b-tree,hence increasing size of view file? what best way handle situation while conserving disk space , ensuring speed of views?

c# - Generic method to compare 2 strongly typed list -

i have following method compares 2 list (of same type) , returns differences. how make method accept lists of type? var differences = list1.where(x => list2.all(x1 => x1.name != x.name)) .union(list2.where(x => list1.all(x1 => x1.name != x.name))); to difference between 2 sets (with order independency , multiplicity independency), can use: hashset<t>.symmetricexceptwith(ienumerable<t>) . public static ienumerable<t> getsymmetricdifference<t>(ienumerable<t> list1, ienumerable<t> list2, iequalitycomparer<t> comparer = null) { hashset<t> result = new hashset<t>(list1, comparer); result.symmetricexceptwith(list2); return result; } in case, use it: var difference = getsymmetricdifference(list1, list2, new mycomparer()); with custom comparer: public class mycomparer : iequalitycomparer<mytype> { public bool equals(mytype x, mytype y) { return x.name.equals(

c# - New line disappears after Invoke -

i've got silly minor problem here. context, using c#, i'm communicating between sockets , want display output worker threads. i have these lines display output: txtoutput.appendtext("client - sending following message: " + encoding.utf8.getstring(bytes) + environment.newline); txtoutput.invoke(new action(() => txtoutput.appendtext("client - server returned message: " + str + environment.newline))); the first line added program's main thread, second worker thread. the first line shows fine, second 1 too. when sequence again, first line b pasted onto second line a, second line b looking correct again. second line's newline disappearing, don't understand why or how fix this. can try this. think problem encoding. when send message: string message = input(textbox ex); utf8encoding utf8 = new utf8encoding(); byte[] encodedbytes = utf8.getbytes(message); and keep code @ receive. i tested following: public partial clas

java - How to switch instances in WebDriver -

hi have following setup current framework, classa { //which receives selenium webdriver call 'driver' object reference manipulate locators in ui public webdriver get() { return mainclass.driver; } } mainclass { public static webdriver driver; method a() { //which uses firefox instance , passed classa operate driver = new firefoxdriver(); } methodb() { //which creates new instance of chrome driver = new chromedriver(); } } what wanted once call methodb() instance of chrome created once done want resume firefox instance available or invoked before chrome run, approach since referring same webdriver object old firefox reference getting deleted. any suggestions ? ps: please forgive bad code conventions followed simplest solution create seperate objects ff , chrome. modify method take parameter(browsertype) , return correspoding object. why switching browsers?

html - Button on table header -

i have problem old site , need place button in div element, on top of table. <div class="panel2" style="border: 1px solid red;"> <div id="charinfo"> <input type="button" id="locklist" name="locklist" value="lock wl" /> <table width="500px" style="border:1px solid #000;border-collapse:collae;font-familyrif;font-size:80%;"> <caption style="font-size:140%;padding:5px;">wish list status <b>tyde</b> </caption> <thead> <tr> <th scope="col">zone name</th> <th scope="col">wish items</th> <th scope="col">received</th> <th scope="col">status</th> </tr> </thead

Where does virtual memory exist in linux? -

as program stored on flash/disk. execution, program loaded virtual memory , mapped ram virtual manager. during execution process in ram. virtual memory exist (where has .text, .data, .stack, .heap)? the virtual memory view of ram plus maybe swap space provided virtual memory manager. modern oss have virtual memory managers , provide virtual memory processes executing program can behave if had contiguous address space size not limited actual ram. pages or blocks making virtual memory can mapped anywhere in ram, contiguos virtual pages need stored in contiguos ram areas. or can swapped out page space or swap space, waiting there until needed, whereupon they're read os , mapped ram page. when during execution process in ram. this not entirely correct. or memory pages belong process may swapped out, explained. one more word concerning answers , comments "virtual" means doesn't exist. makes no sense. on contrary, according webster: being such

java - Unable to download complete file in android app -

following code, from activity class intent intent = new intent(this, downloadservice.class); // create new messenger communication messenger messenger = new messenger(handler); intent.putextra("messenger", messenger); intent.setdata(uri.parse("http://www.abc.ezy.asia/e-mobapps/op.apk")); intent.putextra("urlpath", "http://www.abc.ezy.asia/e-mobapps/op.apk"); startservice(intent); i have overrided service class method onhandle event // downloadservice class @override protected void onhandleintent(intent intent) { uri data = intent.getdata(); string urlpath = intent.getstringextra("urlpath"); string filename = data.getlastpathsegment(); file output = new file(environment.getexternalstoragedirectory(),filename); if (output.exists()) { output.delete(); } inputstream stream = null; fileoutputstream f

linux - PC not synchronizing time automatically with NTP Server (Centos 6) -

i'm trying configure remote machine synchronize ntpserver without success... it works when run ntpdate server_name, doesn't synchronize automatically. i have stopped iptables in both server , pc. in /etc/ntp.conf file have "server server_name iburst". any idea of can problem? perhaps can create cron job schedule synchronization way of ntpdate, adding line root crontab so: 5 * * * * /usr/sbin/ntpdate your.ntpserver.com

asp.net mvc 4 - RAZOR Syntax building a menu -

i dipping in mvc4 , razor first time: trying build menu dynamically: @foreach (var menu in model.menu) { <li> html.actionlink("@menu.name", "@menu.view", "@menu.controller"); </li> } the menu class works output not literal, rather string: html.actionlink("home", "index", "home"); html.actionlink("menu1", "index", "menu1"); html.actionlink("menu2", "index", "menu2"); what need change output actual literals? edit: used basis above: <li>@html.actionlink("menu1", "index", "menu1")</li> menu class: public class menuitem { public string name { get; set; } public bool isactive { get; set; } public string controller { get; set; } public string view { get; set; } } try this, have not set @ before html.actionlink treating text @foreach (var

sed insert multiple lines before multiple lines pattern -

i have following long file: ... close unit 1 ... ... close unit 1 ... ... close unit 1 stop i want insert multiples lines before last close unit 1 before stop . file contains undefined number of close unit 1 . i found lot of other similar questions here , there, answers couldn't me... example tried https://stackoverflow.com/a/8635732/1689664 didn't work... using sed , tac : $ tac inputfile | sed '/close unit 1/ {s/\(.*\)/\1\nline3\nline2\nline1/; :loop; n; b loop}' | tac ... close unit 1 ... ... close unit 1 ... ... line1 line2 line3 close unit 1 stop note you'd need specify input lines in reverse order in sed expression.

appender - Setting a log file name to current time up to seconds but generating a log every hour in Log4j -

i generate log file every hour name should appended date , time seconds. eg of log name : testlog.log_13.07.11_12.33.40.log i have included following code in appender : param name="datepattern" value="' 'yy.mm.dd' 'hh.mm.ss'.log'"/ but generates log file every second. is there anyway generate logs every hour?

PHP gives T_STRING error when connecting to MySQL -

code looks fine, throws error: "parse error: syntax error, unexpected t_string in /home/u924861036/public_html/press.php on line 7" <?php $ip = $_server['remote_addr']; $type = $_post['type']; $data = $_post['data']; mysql_connect(“localhost”, “user_name”, “pass”) or die(“could not connect: ” . mysql_error()); mysql_select_db(“db_name”); the second last line line 7, if delete it, error same, there error in line 8 also. your double quotes weird. try this: <?php $ip = $_server['remote_addr']; $type = $_post['type']; $data = $_post['data']; mysql_connect("localhost", "user_name", "pass") or die("could not connect: " . mysql_error()); mysql_select_db("db_name"); and please use mysqli or pdo instead of mysql_* functions. why shouldn't use mysql_* functions in php?

asp.net mvc - Syntax complicated column in webgrid -

the column want accomplish has 3 possible outcomes. the paiddate not empty --> show paiddate the paiddate empty , duedate < --> shows: paiddate / "with reference" / reference + add class "green" the paiddate empty , duedate > --> shows: paiddate / "with reference" / reference + add class "red" the code i'm using doesn't recognize 'item' , have syntax errors aswell. how should build these if structures inside razor page using webgrid codesample grid.column("", "to paid before", (item) => if(item.paiddate != null) { string(item.paiddate); } else{ if(item.duedate < @datetime.now) { /*class red*/

javascript - How can i insert html element between start and end tag of another html element using jquery -

i have textbox : <input type="text"></input> i want add span between input element using jquery below: <input type="text"><span>added span</span></input> how can achieve that? i answer 3 questions: how append html in element? use jquery: $('div').append('<span>added span</span>'); how add placeholder input element? use following markup: <input type="text" placeholder="my placeholder" /> (browser support: http://caniuse.com/input-placeholder ) how add text default in input? use following markup: <input type="text" value="my text" />

Read XML node attributes without using node name in SQL Server query -

i have xml stored database different tag names same attribute names: <book category="hobbies , interests" propertyname="c#" categoryid="44" /> <sport category="hobbies , interests" propertyname="cricket" categoryid="46" /> these 2 examples tag name can anything. want read "propertyname" attribute node. is possible? if yes please guide me. declare @xml xml set @xml = '<book category="hobbies , interests" propertyname="c#" categoryid="44" /> <sport category="hobbies , interests" propertyname="cricket" categoryid="46" />' select t.c.value('@propertyname', 'varchar(100)') @xml.nodes('/*') t(c) if expect there can elements without propertyname attribute, can use: select t.c.value('@propertyname', 'varchar(100)') @xml.nodes('/*[@propertyname]') t(c) if expect

Built-in binary search tree in Python? -

are there self-balancing binary search tree ( red-black , avl or others) built-in types in python 2.7 or python 3.x? i looking equivalent java's treemap or treeset . if there no such built-ins, why have been ommited? there special reason, not including such tools? there's no special reason, knowledge - i'd guess reason many applications highly-tuned dict , set implementations (which hash tables) work well. they're enough in cases. there situations need performance characteristics of balanced binary search trees (like ordered traversal based on key- rather addition-order), far enough off beaten path people happy grabbing third-party package in case. i've had experience using bintrees package on pypi. has implementations of unbalanced, avl , red-black binary trees, in both pure python , extensions written in cython . i think rest of reason historical accident. if person wrote bintrees lobbied inclusion in stdlib, , willing put constraints im

Can you mix CodeIgniter code with non-framework code? -

so, situation have this: responsible refactoring 1 part of large web site. until recently, site has been cobbled co-ops supervised people not know web development. resulting code horrible mess. start using framework, not possible stop other development in order refactor entire site , make use of codeigniter site-wide straight away. instead, start doing work assigned in codeigniter , expand use other parts of site time , workload permit. while sure possible this, how difficult it? there 'gotchas' of need aware? insights can offer based on experiences appreciated. have done projects in codeigniter start before, , have done projects use no framework @ all, have never tried migrate project uses no framework project uses framework before. you've answered question yourself. best tip can give you'd have heavily rely on mod_rewrite until you've recoded everything.

c# - Exclude UICulture string (ex: en-US) from URL generated by UrlHelper.Action? -

firstly, testing website url http://localhost:51889/mvts despite currentuiculture string not being present in above url, when declare @url.action("actionone","user") in main.cshtml, ui culture string exists in script tag. <script type="text/javascript" src='/mvts/en-us/user/actionone'></script> what wish able exclude "en-us" "src" in above tag looks this: <script type="text/javascript" src='/mvts/user/actionone'></script> can please tell me how may accomplish this? have been searching while , haven't found solution yet. check routes definition. have rule attribute {culture} . you can delete attribute or, if need in other sections of application, can add route definition without culture and, in place of url.action , can use url.routeurl (giving, parameter, name of route definition).

Is Myrrix a good choice for content-based recommendations? -

i understand myrrix's support user > item-based collaborative filtering-style, work me; need support content-based recommendations items, using custom similarity algorithm. if user selects item x, able see n-most similar items, irrespective of ratings. that algorithm compare items based upon intrinsic characteristics , attributes, , can supply algorithm in java, supported in myrrix? in indirect way, yes. can add 'tags' if users , items -- is, user tag item user interacts with. provides way inject information user attributes, , vice versa items. under hood, these work actual users , items in algorithm. see settag() method , api methods.

hibernate - How to restrict other columns data getting updated while updating specific columns of a table -

how restrict columns want update in database table rather updating columns of table? the following update remarks column @test public void updateproject() { try { project project = new project(); project.setprojectid(234l); project.setremarks("from junit"); projectservice.update(project); } catch (exception e) { system.out.println("error" + e.getmessage()); e.printstacktrace(); } } when execute above updated other column in table, consequently makes other column values null. how can resolve issue? daoimpl code @override public void update(project project) { entitymanager.merge(project); entitymanager.flush(); } update 1 modified code @test public void updateproject() { try { project project = new project(); project = projectservice.load(234l); project

javascript - use underscore to exclude file and directories -

i have node.js / express application uses i18next localization of site. currently pulling list hard coded version: https://github.com/tzm/tzm-blade/blob/master/app/config/apps.coffee#l105 make list reading locales directory , making list that. i exclude dev , readme.md , config.json being returned , have other directories can return correct country local example using node-cldr library extract language display name per https://github.com/papandreou/node-cldr#cldrextractlanguagedisplaynameslocaleidroot : ☺ node ruby-2.0.0-p195 master 2253522"" > var cldr = require('cldr'); undefined > cldr.extractlanguagedisplaynames('ru').ru; 'русский' > etc... so far looking @ reject http://underscorejs.org/#reject collection don't see how remove these files , directories fs.readdir "./locales", (err,locales) -> results = [] __.reject locales, (value, index, list) -> console.log value, index, list

Reading JSON data (created by PHP) via jQuery Ajax results in "parserror" -

i create json-data following php code: if($res = $db->query('select row1 table1')){ while($row = $res->fetch_row()){ $json[] = $row; } } sort ($json); $json = json_encode($json); echo $json; the result [["1"],["2"],["3"]] . when try fetch data jquery ajax <div id="output">json put here</div> <script language="javascript" type="text/javascript"> $(function () { $.ajax({ url: 'json.php', datatype: 'json', data: '', error: function(request,error) { alert(error); }, success: function(data) { var json = data[0]; alert(json); $('#output').html(json+", "); } }); }); it says: "

java - how to disable a list element in swt list eclipse -

is possible disable elements of swt list display.i want list display clickable strings , few disabled strings based on conditions.is possible this? if want add selection listener detect if selection on "disabled" item , adjust up/down/clear selection depending on list contents. you may use table single column - should able custom-draw disabled items (e.g. use lighter font or different background).

c++ - Using a .lib file in a C# program -

i have header file , .lib file created using c++. now want use in c# program. possible? you can create managed wrapper , see step step instruction here: http://tom-shelton.net/?p=95

How to add custom attributes to ASP.NET controls -

i've got asp.net control checkbox: <asp:checkbox id="mychck" runat="server" value="mycustomvalue" /> is possible add custom value attribute code-behind , respectively value value something (psuedocode): myckck.value = "blq blq"; string chckvalue = mychck.value; how can this? it's possible: myckck.attributes.add("value", "blq blq"); string chckvalue = mychck.attributes["value"].tostring();

python - Pygame Sprite. How to create different enemies/images from same class? -

i building tiny platform based game pygame. want go having 1 graphic enemies, several different graphics. idea put them in array , draw randomly upon initing several sprites randomly picked graphics. but result either enemy1.png or enemy2.png sprites. not sure if simple , not able see it, or if need extend enemy class each new graphic want enemies have? i tried 2 things same, , same result both. first idea: class enemy(pygame.sprite.sprite): enemyarray = [pygame.image.load('enemy1.png'), pygame.image.load('enemy2.png')] def __init__(self, location, *groups): super(enemy, self).__init__(*groups) in self.enemyarray: self.image = choice(self.enemyarray) self.rect = pygame.rect.rect(location, self.image.get_size()) self.direction = 1 second idea: class enemy(pygame.sprite.sprite): enemyarray = [pygame.image.load('enemy.png'), pygame.image.load('bomb.png')] in enemyarray:

Use the right alignment for a buffer which is supposed to hold a struct in C++ -

suppose have struct, say struct s { double a, b; ~s(); // s doesn't have pod }; such struct should typically have alignment of 8, size of largest contained type 8. now imagine want declare placeholder struct hold value of s : struct placeholder { char bytes[ sizeof( s ) ]; }; now want place inside of class: class user { char somechar; placeholder holder; public: // don't mind hacky -- shows possible use // that's not point of question user() { new ( holder.bytes ) s; } ~user() { ( ( s * )( holder.bytes ) )->~s(); } }; problem is, placeholder aligned incorrectly within user . since compiler knows placeholder made of chars, not doubles, typically use alignment of 1. is there way declare placeholder alignment matching of s in c++03? note s not pod type. understand c++11 has alignas , not universally available yet, i'd rather not count on if possible. update : clarify, should work s - don't know contains. i beli

SciTe and Python 3 - problems with configuration [UBUNTU] -

i have big problem(s) configuration of scite in context of python 3. not know if details have meaning, so: [details] i downloaded , executed gen_python_3_api.py. i created folder "api" in usr/share/scite , copy-pasted there python3.api i edited sciteuser.properties written in documentation of gen_python_3_api.py. did not bit, so: i used more general way found on website of scite. edited python.properties , added line: api.$(file.patterns.py)=$(scitedefaulthome)\api\python.api. still no effect. i edited line of python.properties: if plat_gtk command.go.*.py=python3 -u "$(filenameext)" it worked (or though so). [/details] now want run simple fibbonaci program worked idle. def fib(n): = 0 b = 1 fibl = [] in range (n): fibl.append(a) z = = b b = b+z return fibl n = int(input("number? ")) print(fib(n)) and

How to debug PHP script when it is being accessed by android application -

i have andoid application wich connecting mysql db via web server. on web server have php scipts doing thier work , return json object app. have upgraded web server , db , scrips stopped retrieving data. exact, select stetment parameters don't return data, select on table no parametrs works fine. did 1 encounter similar problem? my actual question is: there debug php scrips? guess debugging via firefox or chrome not possible android application triggering them , not direct access web, all muck appreciated. chrome has set of tools let remote debug android. check them out: https://developers.google.com/chrome-developer-tools/docs/remote-debugging

ios - How do I play video using MPMoviePlayerController over WWAN networks? -

i have mpmovieplayercontroller takes link , plays video off link. using wifi presents no problem, video played , well. using 3g network however, hangs few seconds before throwing mpmovieplayerplaybackdidfinishnotification, localised description of 'the operation not completed'. my code follows: videoplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:videoplayercontroller]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(willenterfullscreen:) name:mpmovieplayerwillenterfullscreennotification

php - How to remove the color indication to the left in PHPStorm? -

Image
how can remove this? it's annoying , looks error: http://i.imm.io/1dwm7.jpeg settings (preferences on mac) type "color preview" in search box (top left corner) p.s. re-opening project (at least, editor tab) quite required.

c# - How to depend by parent class -

i have class handler . in constructor have manager class depends on different settings. kernel.bind<ihandler>().to<handler>(). withconstructorargument("manager", new manager(kernel.get<idataaccessfactory>().createunitofwork(), new custom1settings())); how create injection custom1settings in manager , in handler class handler { handler(imanager manager....) { ... } } class manager { manager(iunitofwork unit, isettings settings) { ... } } ninject automatically figures out dependencies. it's 1 of it's useful features. define binding custom1settings , manager , automatically inject it. so kernel.bind<imanager>().to<manager>(); kernel.bind<icustom1settings>().to<custom1settings>();

Html5 canvas drawImage: how to apply antialiasing -

Image
please have @ following example: http://jsfiddle.net/mlgr4/47/ var canvas=document.getelementbyid("canvas"); var ctx=canvas.getcontext("2d"); img=new image(); img.onload=function(){ canvas.width=400; canvas.height=150; ctx.drawimage(img,0,0,img.width,img.height,0,0,400,150); } img.src="http://openwalls.com/image/1734/colored_lines_on_blue_background_1920x1200.jpg"; as see, image not anti-aliased although said drawimage applies anti aliasing automatically. tried many different ways doesn't seem work. please tell me how can anti-aliased image? thanks. cause some images hard down-sample , interpolate such 1 curves when want go large size small. browsers appear typically use bi-linear (2x2 sampling) interpolation canvas element rather bi-cubic (4x4 sampling) (likely) performance reasons. if step huge there not enough pixels sample reflected in result. from signal/dsp perspective s

maps application - best way to store co-ordinates in MongoDB -

i'm making maps application. have co-ordinates of bunch of locations. want return points within area visible on screen. done google maps api. gives north-east , south-west co-ordinates of map visible on screen. i'm using mongodb. the obvious way take midpoint of ne-sw diagonal center, distance either corner radius, , find points within radius. but storing them in single list o(n) operation - not scalable every request. better way of storing them able points quickly? i'm thinking of splitting them buckets contain points within radius(r), , maintain sorted list of buckets instead. since screen can on 4 buckets at-most (every corner on separate bucket), find closest bucket in o(log n) , next 3 closest ones in o(1). have computations these 4 buckets. but that's still lot of buckets! google able render points on map quickly. , have lot of points. , lot of users. how manage that? don't expect reach level of optimization, there's got better data structure.

php - form function registration not inserting into database -

after recent topic found out register page not inserting mysql first things first know i'm still using mysql change pdo when evrything working. so here's thing the following parts being used insert database form <div id="registerform"> <form action="process.php" method="post"> <ul> <li>username : <br /> <?php echo $form->error("user"); ?></li> <li><input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>"></li> <li>password : <br /> <?php echo $form->error("pass"); ?></li> <li><input type="password" name="pass" maxlength="30" value="<?php echo $form->value("pass"); ?>"></li> <li&

loops - php pagination and search -

i have while loop pagination have idea how make search don't know how insert here's code pagination , output commands working don't know how put code search , it's messing head. //count total number of row in table*/ $count_query = mysql_query("select count(personid) numrows persons"); $row = mysql_fetch_array($count_query); $numrows = $row['numrows']; $total_pages = ceil($numrows/$per_page); $reload = 'index.php'; //main query fetch data $query = mysql_query("select * persons order rand() limit $offset,$per_page"); //loop through fetched data while($result = mysql_fetch_array($query)){ $id = $result['personid']; echo "<div class= content > "; echo"<img height=100 width=100 src='upload/". $result['image'] ."'/>"; echo "<font color='black'>". $result['firstname']. "</font></br>"; echo "</div>&q

ruby - Validating DTD-String with Nokogiri -

i switching libxml nokogiri. have method in code check if xml document matches dtd. dtd read database (as string). this example within irb session require 'xml' doc = libxml::xml::document.string('<foo bar="baz" />') #=> <?xml version="1.0" encoding="utf-8"?> dtd = libxml::xml::dtd.new('<!element foo empty><!attlist foo bar id #required>') #=> #<libxml::xml::dtd:0x000000026f53b8> doc.validate dtd #=> true as understand #validate of nokogiri::xml::document possible check dtds within document. how archive same result? i think need internal_subset : require 'nokogiri' doc = nokogiri::html("<!doctype html>") # can info want doc.internal_subset # nokogiri::xml::dtd # example can name, system_id, external_id, etc doc.internal_subset.name doc.internal_subset.system_id doc.internal_subset.external_id here full doc of nokogiri::xml::dtd . thanks

.net - Twitter Bootstrap Modal Not Working in DNN -

i running dnn 6.2 , have developed skin using toolkit twitter bootstrap. of functions work correctly except modals. http://twitter.github.io/bootstrap/javascript.html#modals when implemented, use html/pro module , import code through that. example, if create button calls modal, when clicked, overlay appears, modal drops in, modal behind overlay. i've tried: adjusting z-index's placing modal content outside of skins container, while keeping button still in html/pro module. i function working correctly, suggestions? you might try adjusting z-index .dnnmodule class has z-index of 900 , causes problems. in skins set @ 100 you can see sample of 1 of skin.css files @ https://multifunction.codeplex.com/sourcecontrol/latest#skin.css

ASP.NET Newbie - can't update DataGrid from SQL database -

i'm new asp.net , trying pull simple web app allow users view (for that) data sql database based on selections listbox , dropdown. idea click on button after selections made return database results based on stored proc being passed list , dropdown selections parameters. think i'm pretty close can't seem return results datagrid designated purpose. c# code i'm running below. appreciated!!! using system; using system.collections; using system.configuration; using system.data; using system.linq; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using system.xml.linq; using system.windows.forms; using system.data.sqlclient; namespace timeline_analytics_app_test { public partial class default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void button1_click(objec

How do you wrap and indent strings from dictionary in python output? -

i need in wrapping output text. need print reference book+chapter+verse number , actual verse. need line wrap @ 100 characters , align first part printed. i have: from operator import itemgetter logfile = "kjv.txt" def bible_read(): fp=open(logfile,'r') store=[] while 1: line=fp.readline() if not line: break if line[-1:] == '\n': line=line[:-1] data0=line.split(' ')[0] data1=line.split(' | ')[1] data2=line.split('|')[2] store.append({'line':data0,'chap':data1,'verse':data2}) fp.close() #print store[1] chapter = raw_input("enter:") if '-' in chapter: book = chapter.split(" ")[0] w = chapter.split(":")[0] w = w.split(" ")[1] x = chapter.split(":")[1] x = x.split("-")[0]

loops - Python - most efficient way of matching a list -

say example have list of 7 numbers, let's call 'linea' , have 50 lines of numbers below , want see if 'linea' matches 50 lines in order. quickest (time-wise)/most efficient way of doing it? loop? or other method? linea = [1,2,3,4,5,6,7] linetwo = [1,33,40,44,45,1,2] linethree = [2,13,22,41,50,8,9] linefour = [1,2,3,4,5,6,7] linefive = etc.....(repeat 50 times) thank you you can compare 2 lists == operator: if linea == lineone: print 'they match!' now, keep lines in list: lines = [lineone, linetwo, linethree, ..., linefifty] and find lines match: matches = [line line in lines if line == linea] you can't more efficient comparing each line ( o(n) ). unless sort input first. use bisect module , o(log n) performance. if want compare lineb, linec, linez lines well. otherwise don't bother, because sorting compare lines o(n * log n) ...

python - Inheriting AbstractConcreteBase multiple times [was: Adding an Auto-ID field to a model base class via mixin] -

i have created modelbase class application of mine based on sqlalchemy. to save me tedious work of having type out id = column(integer, primary_key=true) provided attribute default id on modelbase class. base = declarative_base() class modelbase(abstractconcretebase, base): id = column(integer, primary_key=true) def __init__(self, *args, **kwargs): """ constructor """ # nifty magic, keyword cleaning on kwargs, might have data # coming json input super(modelbase,self).__init__(*args, **kwargs) def do_sth_else(self): """ shared fundamental logic, json (de)serialization """ i should't have done this, because classes have id integer field. turns out, want use composite keys on models, still want have default of model class having id primary key. decided write mixin class , provide different modelbase classes. base = declarative_base() class idmixin(obj