Posts

Showing posts from August, 2012

sorting - Python list sort in descending order -

how can sort list in descending order? timestamp = [ "2010-04-20 10:07:30", "2010-04-20 10:07:38", "2010-04-20 10:07:52", "2010-04-20 10:08:22", "2010-04-20 10:08:22", "2010-04-20 10:09:46", "2010-04-20 10:10:37", "2010-04-20 10:10:58", "2010-04-20 10:11:50", "2010-04-20 10:12:13", "2010-04-20 10:12:13", "2010-04-20 10:25:38" ] timestamp.sort(key=lambda x: time.strptime(x, '%y-%m-%d %h:%m:%s')[0:6], reverse=true)

html - Rendering tweets on the web page -

i have web page has part render filtered entries twitter. part of page created using xslt (i using umbraco cms). problem when there special characters such ' in twitter entry, although used "disable-output-escaping ="yes"" in ie rendered & apos ;. in other browsers fine. should handle issue regards, the problem when there special characters such ' in twitter entry, although used "disable-output-escaping ="yes"" in ie rendered & apos ;. in other browsers fine. should handle issue without showing specific code receive general answers such question. here example of 2 ways produce apostrophe without needing @ doe : this transformation : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/"> <p>it's monday today&

Getting anchor name with php regex -

i need capture name of anchor html tag regex , php text "hello" (the name of anchor) tried that: $regex = '/(?<=name\=")#([^]+?)#(?=")/i'; preg_match_all($regex, $content, $data); print_r($data); i've tailed apache error log find out that: php warning: preg_match_all(): compilation failed: missing terminating ] character class @ offset 26 also tried: $regex = '/(?<=name\=")([^]+?)(?=")/i'; $regex = '/(?<=name\=")[^]+?(?=")/i'; which same. guess i'm missing something, silly slash or i'm not sure what will appreciated thanks solved ok, @stillstanding , @gordon i've managed domdocument simple so, record, here snippet $dom = new domdocument; $dom->loadhtml($content); foreach( $dom->getelementsbytagname('a') $node ) { echo $node->getattribute( 'name' ); } use domxpath along domdocument or simplexml. never,

Network graph in javascript, possible with jQuery alone? -

i need implement particular network graph in javascript. i've looked @ infovis toolkit , protovis, i'd have implement custom layout them , lot of custom code. i'm not sure add value. widget needs super efficient go on many highly visited webpages, don't want widget slowing down. the nodes of graph html-rich. dropdowns, input elements, popups, etc. div's make lot of sense each node. create divs in javascript using ajax read data server. implement layout mechanism in javascript , animate when adding/updating/deleting nodes through jquery. the thing can think of preventing me using jquery connections between nodes. how draw them? might able use raphael underneath nodes , coordinate between node positions , raphael, after briefly looking @ raphael, looks tricky. is there simpler way draw connections between nodes? ie support important @ least ie8. preferably lines can curved , patterned (dotted lines, double lines, etc) represent different types of

unix - dlopen()/dlsym() on the main executable: how portable is it? -

i'm building compiler , virtual machine executing byte code. language allows bind external c functions, may defined in external shared object, main compiler/vm binary (some essential language built-ins). i know can dynamically bind symbols within main executable dlopen(null, ...), not after run strip on binary. have following questions then: is there way on strip'ed binary? how portable feature across unix systems in general? is possible same trick on windows somehow? any alternatives ways of binding dynamically within main executable? use strip -d instead strip debug symbols. the dlopen(3) man page says: conforming posix.1-2001 describes dlclose(), dlerror(), dlopen(), , dlsym(). so, portable across *nix. windows uses loadlibrary() , getprocaddress() instead. no.

What tools exist for parsing Javascript and reading the results in Javascript or Ruby? -

i'd code-analysis of javascript. i'd prefer operate on ast s or s-expression s. it's possible v8 engine builds this, though can't seem find documentation on how access information javascript context. i'd happy analysis in ruby, though way can think of doing write entire grammar in treetop or similar parser-generator. check out uglifyjs: https://github.com/mishoo/uglifyjs

NHibernate: cannot append items to map element -

i have map element in mapping - <component name="resources"> <map name="inner" table="sometable" lazy="false" fetch="join" access="field.lowercase-underscore"> <key column="id"/> <index column="indexid" type="string"/> <composite-element class="someresource"> <property name="name"/> </composite-element> </map> </component> i want append items in sometable in following way - var ent = new entity(); ent.resources.add("key1", new someresource()); var saved = session.saveorupdate(ent); session.session.flush(); session.session.clear(); var newentity = new entity {id = saved.id}; ent.resources.add("key2", new someresource()); session.sa

ejb - several EARs, JPA and interfaces -

i have working app1.ear , containing: jpa entity, myobjectimpl , implementing interface myobject api.jar api.jar myobject interface , ejb remote interface ejb.jar ejbs providing methods access , modify jpa entities second app2.ear supposed communicate app1.ear using interfaces in api.jar . works fine when passing java basic types between ears. when app2.ear tries retrieve app1.ear instance of myobject - corba marshal exception raised, saying myobjectimpl class can not found: "iop00810257: (marshal) not load class com.zzz.myobjectimpl" placing myobjectimpl in app2.ear solves issue, don't want expose jpa implementation other ear applications. missing or approach wrong? please advise or dig. many in advance! ps: server gf 3.0.1, no gf-specific deployment descriptors, both ears running on same jvm the impl classes required during deserialization. approach use xml or json or protobuff, if doesn't want expose impl classes.

visual studio 2010 - Writing VS2010 Extension -

i'd create extension visual studio 2010. functionalities need these: add context menu item project (when user right clicks project name in solution, he'll context item in list). when clicks, new winforms form appears, can input data, , option save data future reuse. when clicks ok on form i'll generate files , add files part of project rightclicked. the wscf.blue kind of behaviour want immitate in vs, it's source written in vs2008, , i'd use vs2010 extension options quite changed understand... i found resources on msdn, found confusing incomplete info (e.g. menuandcommands example). can shed light on how achieve i'm after? i don't know point out can specific examples of trying achieve. however, in following resources find complete , detailed information overall process, , achieve 1. , 2. vs 2010 package development – chapter 1: visual studio packages vs 2010 package development – chapter 2: commands, menus , toolbars

amazon ec2 - Why do Windows snapshots take a long time? -

i running vanilla windows install on amazon ebs volume. computer takes 10 minutes boot, may understandable 2 reboots required. however, taking snapshot 10-15 minute process. can explain this? way speed up? bit surprised, because thought snapshots immediate replicas of running ebs volume, in case shouldn't take couple of seconds complete? i add console shows "snapshot" completed quickly. "ami" section seems take 10-20 minutes. what's difference? snapshot available use immediately, or need wait ami? from ebs product page : amazon ebs snapshots incremental backups, meaning blocks on device have changed since last snapshot saved. if have device 100 gbs of data, 5 gbs of data has changed since last snapshot, 5 additional gbs of snapshot data stored amazon s3. subsequent snapshots fast because changed blocks need saved. time takes scales amount of changes since last snapshot. is snapshot available use immediately, or

unicode - How do I paste non-ASCII characters into vim? -

my terminal emulator configured unicode character encoding , .vimrc contains line set encoding=utf-8 but when try pasting word "café" vim, comes out "café". i can make "é" in vim typing ctrl-vu followed 4-character code point (00e9) i'd ability paste in. the solution uncheck "escape non-ascii input" checkbox in advanced tab of terminal.app settings.

sql - Creating a Mysql database -

i want create mysql database should contain users of site, , there should option of adding other users friends. should fields of database. i cannot tell user table should cover. need know yourself. ;) need second table, e.g. "friend", holding 2 fields: 1 actual user , 1 friend of user. so, have m:n relation between user table , itself.

javascript - What is wrong with my Regex? -

i'm using javascript test ending of file selected uploaded server. the regex this: (jpg|jpeg|png|gif|bmp)$ and works fine long file extensions in lower case, when this /(jpg|jpeg|png|gif|bmp)$/i i doesn't match anything. can tell me why? doing wrong? use 'i' parameter i.e. regexp("(jpg|jpeg|png|gif|bmp)$", "i")

php - Zend DB: null values -

i appreciate if 1 explain why query returning null values. this query works fine when use fetchrow() method. public function getcustomerrowwithaddress($customer_id) { $select = $this->select()->setintegritycheck(false); $select->from('irh_tv.irh_site_location sl', array('name location_name', 'start_date', 'end_date', 'service_pack_id', 'stb_id')); $select->joinleft('irh_tv.irh_customers c', 'c.customer_id = sl.customer_id , c.active = 1 , c.site_id = sl.site_id', array('customer_id','surname', 'title', 'site_id', 'first_name', 'company', 'business_no', 'home_no', 'mobile_no', 'email', 'address_id')); $select->joinleft('irh_tv.tv_stb_data tv', 'tv.site_id = sl.site_id , sl.stb_id = tv.id', array('user_id mac_address')); $select->joinleft('irh_tv.irh_addres

java - Maps and strings in Drools rules -

i have following drools rule send map filled element , when gets executed have element . why null when should "y" value? when put breakpoint in acdebug.debug() method , inspect map after $map.put() executed looks good, has "y" value, after rules executed have null? has have similar problem? import java.util.map; import java.util.hashmap; import edu.abc.acdebug; rule "postprocessor 8" ruleflow-group "supress-processor" when $map:map(keyset contains "standard_address:street_name") acdebug.debug($map, "map before put: "); $map.put("/locationlist/sourceaddress/fullstreet",new string("y")); acdebug.debug($map, "map after put: "); $map.remove("standard_address:street_name"); end after have done changes map, need update. lets working memory know modified map. add following line: update( $map );

javascript - Display two decimal places, no rounding -

suppose have value of 15.7784514, want display 15.77 no rounding. var num = parsefloat(15.7784514); document.write(num.tofixed(1)+"<br />"); document.write(num.tofixed(2)+"<br />"); document.write(num.tofixed(3)+"<br />"); document.write(num.tofixed(10)); results in - 15.8 15.78 15.778 15.7784514000 how display 15.77? convert number string, match number second decimal place: var with2decimals = num.tostring().match(/^-?\d+(?:\.\d{0,2})?/)[0] the tofixed method fails in cases unlike tostring , careful it.

types - How can I check if my python object is a number? -

this question has answer here: python: pythonic way check if object number 10 answers in java numeric types descend number use (x instanceof number). what python equivalent? in more recent python versions (2.6+; in older versions you're pretty limited checking few hardcoded types), correct way test if variable instance of numbers.number : >>> import numbers >>> import decimal >>> [isinstance(x, numbers.number) x in (0, 0.0, 0j, decimal.decimal(0))] [true, true, true, true] this uses abcs , work build-in number-like classes, , third-party classes if worth salt (registered subclasses of number abc). however, in many cases shouldn't worry checking typed manually - python duck-typed , mixing compatible types works, yet barf error message when operation doesn't make sense ( 4 - "1" ), manually checking ne

c# - Crystal Reports massive generator -

i have problems connecting report's database. in log see exception thrown : "log on failed". this do: using service needs massive generate reports. when opening report crystal reports ok, when using service, throws exception saying log on failed. i tried verify database menu in crystal reports says date. service uses batch massive generating reports on server. unable connect database. i think there security issues when trying connect database this. can't debug, except logging steps. please ! have tried "canned" crystal reports batch scheduler like: http://www.reportrunner.com http://www.christainsteven.com

printing - WPF: Why TOO SLOW to Get PrintDialog's .PrintableAreaWidth and .PrintableAreaHeight? -

i experiencing extremely wired wpf printdialog issue -- windows xp64 + vs2010. it pretty unbelievable very slow printdialog's .printableareawidth or .printableareaheight property. // see sample codes below - remember include "using system.windows.controls" printdialog pd = new printdialog(); double pw = pd.printableareawidth; // set break-point here, slow, why??? double ph = pd.printableareaheight; anyone has idea regarding this? appreciate thoughts! the printablearea refers actual printer in use - app has contact printer info, , guess that's reason why it's slow. shouldn't faster in winforms... if you'd want optimize, cache printer name , it's defaults , use instead of querying printer each time.

iphone - NSDate get a specific day of the week? -

i hope learning curve i'm going through. i create arbitrary date. want find saturday following third friday. nslog(@"date: %@", [date description]); nscalendar *calendar = [nscalendar currentcalendar]; nstimezone *zone = [nstimezone timezonewithname:@"est"]; [calendar settimezone:zone]; nsdatecomponents *components = [calendar components:(nsyearcalendarunit | nsmonthcalendarunit | nsdaycalendarunit) fromdate:date]; [components setweekday:6]; // 1 = sunday ... 7 = saturday [components setweekdayordinal:3]; // 3rd friday resultdate = [calendar datefromcomponents:components]; nslog(@"date: %@", [resultdate description]); and output: date: 2010-11-01 05:00:00 gmt date: 2010-11-01 05:00:00 gmt why? how can fix this? change components to: (nsweekdaycalendarunit | nsyearcalendarunit) this works: nsdate *today = [[nsdate alloc] init]; nslog([today description]); nscalendar *grego

LINQ query returning a List<> as a class member -

given follow data class, public class employeemenu { public int id { get; set; } public string headername { get; set; } public list<string> itemnames { get; set; } } how can sub-query itemnames field? my current query of iqueryable<employeemenu> retvalue = mh in menuheaders select new employeemenu { id = mh.id, headername = mh.headername, itemnames = (from mhi in mh.menuitems select mhi.menuitemname).tolist<string>() }; doesn't seem doing trick... the data structure menuheaders menuitems ----------- --------- id id headername <-(fk)--menuheaderid menuitemname i ended changing list ienumerable. fixed it.

asp.net - Javascript not executing after partial rendering -

i have asp.net panel hidden , shown when button clicked. there javascript inside panel , doesn't execute after panel set visible. can see javascript function gets outputted on page not called. can make function gets called? here example: <asp:linkbutton id="lbtn" runat="server" text="show" onclick="lbtn_click" /> <asp:updatepanel id="upnl" runat="server" updatemode="conditional"> <contenttemplate> <asp:panel id="pnlcontent" runat="server" visible="false"> content hidden. <script> alert('done!'); </script> </asp:panel> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="lbtn"/> </triggers> </asp:updatepanel> you'll want have sort of end request method gets called

ruby on rails - Is there a way to force RSpec to show intermediate results? -

every time run rspec tests, goes off executing everything. fine, except don't want wait entire suite run before see 1 failure in series was. $ rspec spec/ ...........f................................ i think looking for: http://jeffkreeftmeijer.com/2010/making-rspec-stop-operation-immediately-after-failing/ it makes rspec stop after first failure. you should @ this: http://jeffkreeftmeijer.com/2010/fuubar-the-instafailing-rspec-progress-bar-formatter/ it's better rspec formatter.

Capturing JavaScript error in Selenium -

is there way capture errors occurring in dom in selenium , flag same error in page? to give brief example, let's i'm trying bind event on non-existing html control, browser throws error saying: element abcd not found in console. now, if want same error fail selenium tests , message shown on browser shown error message. is possible this? here information on testing js errors. http://www.silverwareconsulting.com/index.cfm/2010/6/7/checking-for-javascript-errors-with-selenium put script on page , check in selenium jserror: <script type="text/javascript"> window.onerror=function(msg){ $("body").attr("jserror",msg); } </script>

c# - Application.EnableVisualStyles() not working -

i cann't make application apply windows visual styles. application.enablevisualstyles() in program.cs not changing renderwithvisualstyle property true. [stathread] public static void main(string[] startargument) { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); ..... } interestingly if i'm debugging "enable visual studio hosting process", application.enablevisualstyles() works expected, renderwithvisualstyle goes true , styles applied. no styles without hosting process either debug or release mode. changing target framework v.2 v.3.5 makes nothing. any ideas please, i'm stuck issue , googling 3 days no success. many thanks you need embed manifest xml file specifies new version of common controls dll should used. see the msdn article on visual styles more information on how this.

I'm looking for a FTP text editor (on Windows) -

first of all, have no idea if question stack overflow or if better suited 1 of sister sites. i noticed in video - http://www.youtube.com/watch?v=xixdjof7xxq - ian uses text editor enables maintaining ftp connection. whenever saves text-file (which html file in case), update gets sent server automatically. love able that. as use notepad++ in predominately create html , javascript text files. machine windows 7. have web-hosting account (asp.net) domains, includes ftp account, of course. i looking lightweight text-editor enables functionality can seen in above video - want able open text-file (remotely via ftp), edit it, , hit ctrl+s send updated version remote server via ftp. doesn't notepad++ have plug-in this? think noticed while back... not quite you're looking for, filezilla ftp client detect file being edited has been modified , prompts upload (maybe can made automatic also).

java - Size limit on BufferedReader exceeded? -

in java 6 webapp, attempting retrieve large amount of output executed command. i've "borrowed/stolen/based" on javaworld article . problem facing length appears exceed size limit since output lopped off. i've output data file can see size of returned, , 32k (32768). i've experimented changing default size of buffer (see bufferedreader constructor), have not observed change length of data returned no matter value have buffered-size (very small large). any advice appreciated! public class streamgobbler extends thread { private inputstream is; private string type; private list<string> output; public streamgobbler(inputstream is, string type) { this.is = is; this.type = type; } @override public void run() { try { inputstreamreader isr = new inputstreamreader(is); bufferedreader br = new bufferedreader(isr); string line = null; this.output = new arraylist<string>(); while ((line = br.readlin

c++ - Issues passing an ellement of an Array of Records to Temporary Array of Records -

i'm new code monkey in training, , i'm having issues working arrays , structs. have main file have array of records declared. pass array external function, quick sort performed on of fields in record. first name. i'm having issues copy elements in array of records, temporary array sorting algorith. know c++ have qsort function built in, i'm working on right now, need have algoritm written out way is. able work using array. i'm getting following error when trying compile make file. make g++ -c -o main2.o main2.cpp g++ -c externarray2.cpp -o externarray2.o externarray2.cpp: in function ‘void copytemp(employeerecord*, employeerecord*, int, int)’: externarray2.cpp:52: error: cannot convert ‘float’ ‘void*’ argument ‘1’ ‘void* memcpy(void*, const void*, size_t)’ externarray2.cpp:53: error: cannot convert ‘float’ ‘void*’ argument ‘1’ ‘void* memcpy(void*, const void*, size_t)’ externarray2.cpp:54: error: cannot convert ‘float’ ‘void*’ argument ‘1’ ‘void* memcpy(v

How to create a multi-edit form in rails -

i need create multi-edit form in rails, so: <form> <input type='text' name='input1'></input> <input type='text' name='input2'></input> <input type='text' name='input3'></input> <input type='text' name='input4'></input> <input type='text' name='input5'></input> <br> <input type='text' name='input1'></input> <input type='text' name='input2'></input> <input type='text' name='input3'></input> <input type='text' name='input4'></input> <input type='text' name='input5'></input> <br> <input type='text' name='input1'></input> <input type='text' name='input2'></input> <input type='text' name='input3'></input> <i

python - How to add extra fields using django.forms Textarea -

i newbie in django , working on pootle project. i add bio (in textarea), interests (textarea), , profile pics (image upload). page looking this: http://pootle.locamotion.org/accounts/personal/edit/ (you might need login see page) i have edited local_apps/pootle_profile/views.py looks this: from django.forms import modelform, textarea class userform(modelform): class meta: model = user fields = ('first_name', 'last_name', 'email', 'bio') widgets = {'bio': textarea(attrs={'cols': 80, 'rows': 20})} and in ""templates/profiles/edit_personal.html" " <form method="post" action="/accounts/{{user.username}}/"> <p> <lab

c# - Formatting XML with tabulation and removing element ending space? -

i trying 2 things: get output xml formated tabulation instead of spaces. remove ending space generates video element. " /> to "/> i have tried use xmlwriter.formatting = formatting.indented; as as indentchar but did not worked me dont know why. this code have currently, hear advices , suggestion improve it: xmldocument xmldoc = new xmldocument(); xmltextwriter xmlwriter = new xmltextwriter(filename, system.text.encoding.utf8); xmlwriter.writeprocessinginstruction("xml", "version='1.0' encoding='utf-8' standalone='yes'"); xmlwriter.writecomment(@" file made @author"); xmlwriter.writestartelement("videos"); xmlwriter.close(); xmldoc.load(filename); xmlnode root = xmldoc.documentelement; foreach (int myid in exportlistids) { xmlelement video = xmldoc.createelement("video"); root.appendchild(video); video.setattribute("videoid", myid.tostring()); }

php - Create a token for each record using Code Igniter and Doctrine ORM -

i have model setup using doctrine. generate token each record, think need overload doctrine's save() function found using symfony: class jobeetaffiliate extends basejobeetaffiliate { public function save(doctrine_connection $conn = null) { if (!$this->gettoken()) { $this->settoken(sha1($this->getemail().rand(11111, 99999))); } return parent::save($conn); } // ... } my current model looks this: <?php class photo extends doctrine_record { public function settabledefinition() { $this->hascolumn('photo_path', 'string', 255, array('unique' => 'true')); $this->hascolumn('count', 'integer', 4, array('unsigned' => 'true')); $this->hascolumn('is_count', 'integer', 4, array('unsigned' => 'true')); $this->hascolumn('region_id', 'integer', 4); $this->hascolumn(

java - How to calculate mean, median, mode and range from a set of numbers -

are there functions (as part of math library) calculate mean , median, mode , range set of numbers. yes, there seem 3rd libraries (none in java math). 2 have come are: http://opsresearch.com/app/ http://www.iro.umontreal.ca/~simardr/ssj/indexe.html but, not difficult write own methods calculate mean, median, mode , range. mean public static double mean(double[] m) { double sum = 0; (int = 0; < m.length; i++) { sum += m[i]; } return sum / m.length; } median // array double[] m must sorted public static double median(double[] m) { int middle = m.length/2; if (m.length%2 == 1) { return m[middle]; } else { return (m[middle-1] + m[middle]) / 2.0; } } mode public static int mode(int a[]) { int maxvalue, maxcount; (int = 0; < a.length; ++i) { int count = 0; (int j = 0; j < a.length; ++j) { if (a[j] == a[i]) ++count; } if (count > maxcount) {

Can you specify the differences ./,../,~/ in ASP.NET? -

what differences between ./ , ../ , , ~/ specifying image in web application? like current directory, root, parent directory, etc. "./" //the current directory "../" //the parent directory "/" //the site root directory "~/" //virtual root web path

ruby on rails - How can I disallow updates except for on one field? -

i've been preventing updates models using in model: def update self.errors.add_to_base( "cannot update #{ self.to_s }" ) end i'm writing plugin delivers functionality model, , need update 1 field in model. if weren't using plugin directly in model... def update if self.changed == ['my_field'] super else self.errors.add_to_base( "cannot update #{ self.to_s }" ) end end i can't same plugin since don't know if update behaviour activerecord default, or has been overridden prevent updates. there way prevent record updates while allowing me override specific field (and in instance plugin applied model). first, should using before_update callback sort of thing rather overriding update. second, can store updatable attributes on model, , update them plugin. wrote in browser, wrong. attr_accessor :updatable_attributes before_update :prevent_update private def prevent_update return true if s

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

i trying implement custom menu internet explorer 7.0. have use idochostuihandler::showcontextmenu only. till able implement basic context menu 2 options. problem disabled default. sample code same is: hresult cwebeventhandler::showcontextmenu(dword dwid,point *ppt, iunknown *pcmdtarget, idispatch *pdispobject) { if (false) // put guard code here. of not consider return s_false; // show standard context menus. else { iolewindow* pwnd = null; hresult hr = pcmdtarget->queryinterface(iid_iolewindow, (void**) &pwnd); if (succeeded(hr)) { hwnd hwnd; if (succeeded(pwnd->getwindow(&hwnd))) { hmenu menu = ::createpopupmenu(); ::appendmenu(menu, mf_string, id_hello, l"&hello" ); // id_hello & id_world 2 menu resource items ::appendmenu(menu, mf_string, id_world, l"&world" );

problem with ExpandableListView in Android -

i have 1 activity (home.class), , activity contains 3 views: first_view.xml, second_view.xml,third_view.xml first_view.xml contains 2 buttons (btnsecond , btnthird). if click btnsecond, second_view.xml appear. if click btnthird, third_view.xml appear. in third view there expandablelistview. extend expandablelistactivity in home.class. there problem. when running, exception occurs: java.lang.runtimeexception: content must have expandablelistview id attribute 'android.r.id.list' when use expandablelistview in xml files, problem solved. want display list in third_view.xml. how can solve problem? make sure name list view "@android:id/list". go here more info.

css - disable horizontal scroll on mobile web -

i'm having issue horizontal scrolls appear on phones site. tried put overflow-x :hidden it's not working. width auto, automatically resize web suits screen size. other phones fine except when viewed in blackberry, nokia e52 , windows mobile, horizontal scroll appear. any advice? thank you! use <meta name="viewport" content="width=device-width, initial-scale = 1.0, maximum-scale=1.0, user-scalable=no" /> in order set width device width.

java - Editing properties files w/o losing formatting -

i have properties (java world) file comments , key=value. want take backup of file , edit few key=value. need edit key in loop number of keys not fixed , key names differ partly not problem, struggling know how maintain format of file (comments, spaces)? # abc system admin database abc_jdbc.password=5667p7jil7k221j+dmnvq== # xyz system admin database xyz_jdbc.password=489slp7jil7k221j+lmnvq== and on...... properties jdk not remember previous state. can use other library it, example commons configuration

h.264 - Playing RTSP with python-gstreamer -

i use gstreamer playing rtsp stream ip cameras (like axis.) use command line this: gst-launch-0.10 rtspsrc location=rtsp://192.168.0.127/axis-media/media.amp latency=0 ! decodebin ! autovideosink and work fine. i want control gui in pygtk use gstreamer python bindings. i've wrote piece of code: [...] self.player = gst.pipeline("player") source = gst.element_factory_make("rtspsrc", "source") source.set_property("location", "rtsp://192.168.0.127/axis-media/media.amp") decoder = gst.element_factory_make("decodebin", "decoder") sink = gst.element_factory_make("autovideosink", "sink") self.player.add(source, decoder, sink) gst.element_link_many(source, decoder, sink) bus = self.player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() bus.connect("message", self.on_message) bus.connect("sync-message::element", self.on_sync_message) [...] but does

cck - Drupal AHAH forms empty data -

i have drupal website multi cck field (or how called? when can "add another" field ahah). the problem is, when click add another, works fine, if wait 5 minutes or so, , click again, ahah fields disapear. my post done correctly, data response, should contain html of fields, empty. does have idea ? ok, found answer. in ahah form use, form loaded cache "form_get_cache()". every 3 minutes cron jub runs, , clears cache, that's why can't retrieved , empty.

javascript - Detect printable keys -

i need detect whether key has been pressed printable key, character, possibly accented, number, space, punctuation symbol , on, or non printable key, enter, tab or delete. is there reliable way in javascript, other listing non printable keys , hope not forget some? i answered similar question yesterday. note have use keypress event character-related; keydown won't do. i argue enter printable, way, , function considers be. if disagree, can amend filter out keypresses which or keycode property of event set 13. function ischaracterkeypress(evt) { if (typeof evt.which == "undefined") { // ie, fires keypress events printable keys return true; } else if (typeof evt.which == "number" && evt.which > 0) { // in other browsers except old versions of webkit, evt.which // greater 0 if keypress printable key. // need filter out backspace , ctrl/alt/meta key combinations return !evt.ct

silverlight - Wpf data visualisation -

Image
i'm using data visualisation libary , want in attached image: two kinds of bars 1 on each other, how can ? visiblox charts offers multivalueseriesbase in free version. extending should able implement chart above.

php - Is OAuth viable for my website's API? -

i'm developing social networking website. service available across various mediums, example: web, iphone, facebook application etc. my idea application have of these properties interact 1 central point fetching , saving data: api. various applications interact api, sending get request fetch data; post request submit data; delete requests , on. this api web-accessible, need way authenticate white-listed applications. api never available third parties interact or build third-party applications with; it's facilitate applications can cut out re-coding solutions across various platforms , focus on logic (controllers, essentially). therefore, oauth suitable used authentication method above scenario? my knowledge of oauth isn't great, if deemed viable solution i'll read on before implementing. far know works on tokens. consumer (for example, website) request token application (the api in instance) , application return token use in subsequent requests. or somethi

web parts - Minimum development environment for sharepoint 2007 webparts -

i know there couple of questions out there sharepoint development environments, wondering if there's shortcut if want develop relatively simple webpart. still have create virtual machine windows server, install sharepoint, sql server, wss etc., etc. or there easy way , running more quickly? in short, what's absolute minimum environment need develop webpart sharepoint 2007? unless willing put serious drawbacks (like not being able debug web part) have build virtual machine windows server. the minimum development environment : -windows server + sharepoint (wss or moss) + visual studio sql express installed visual studio. it take time setup first virtual machine, once have can , use every new project. while develop web part on own machine copying bunch of dlls , hacking up, not worth it. being able debug , deploy fast make development way faster. even if don't need it, still recommend install wspbuilder part of minimal environment. takes 2 minutes inst

asp.net - DetailsView Update command doesn't update unless all of the fields are present! -

i have page binds data db detailsview. i want use auto-generated update command. everything went ok, , updating successful, if remove field don't want have chance update, update command doesn't update! old values retain! i mean: if of fields present in detailsview, update ok, otherwise, update not update thing. i've tried mark fields don't want view "visible = 'false'" no results! how hide fields? thanks :) did try put field don't want update @ 'readonly = true' too? should mark them not updated.

positioning - jQuery: get elements above a given 'y' position -

how can jquery, in elegant way? apply z attribute (e.g.: red background) every children of div parent while position above given top-offset y . i've tried in different ways, i'm not happy of them... know there must short , elegant way it... since you're saying you've tried few ways, , you're looking more elegant, i'll assume have offset part worked out, , i'll go offset myself. modify part needed. elegance, create custom selector checking top offset: $.expr[':'].above = function(obj, index, meta, stack) { return $(obj).offset().top < meta[3]; } you query such: $('#myparentdiv').find('div:above(100)').css('background-color', 'red'); of course have been expressed as $('#myparentdiv div:above(100)').css('background-color', 'red'); or, pointed out in comments var y = 100; $('#myparentdiv div:above('+y+')').css('background-color&#

flex - Why use IEventDispatcher.hasListener()? -

i'm curious performance benefits of using haseventlistener() on blindly dispatching event? for example, see in flex framework code snippets such following: // arraylist.setitemat() var hascollectionlistener:boolean = haseventlistener(collectionevent.collection_change); if (hascollectionlistener) { dispatchevent(new collectionevent(....)) } i assume infers there performance benefits of not dispatching event if no-one listening, versus blindly dispatching it, regardless of whether there listeners attached. however, doesn't seem make sense. surely listeners internally stored within sort of performant hashmap. i'd have thought checking see if listener exists performant iterating through empty array of listeners. therefore, why bother checking, , not blindly invoke dispatchevent method? original code sample clumsier had dispatched event. regards, marty as far can tell, running check redundant. if nobody listening, there nothing in listeners c

.NET Adding Custom Http Headers to Web Service Proxy throws errors -

i need attach custom header web service client. purpose created partial class soaphttpclientprotocol class generated when added web reference. however, receiving runtime error when custom headers attached. works fine if custom headers not attached (when comment code attaches headers). if custom headers added receive following error during runtime: client found response content type of 'text/html; charset=utf-8', expected 'text/xml'. ideas? so here sample code: public partial class smartsws : system.web.services.protocols.soaphttpclientprotocol { private namevaluecollection _customheaders = new namevaluecollection(); protected override system.net.webrequest getwebrequest(system.uri uri) { // add authentication cookie // object cookiecontainer smartsivrsecuritymanager.setauthtoken(this); // set custom headers setcustomheaders(); httpwebrequest req = (httpwebrequest)base.getwebrequest(uri);

perl - Using Moose, how do I set the value of a 'ro' Attribute Trait, in runtime? -

i've got attribute trait want set on basis of other class attributes. realy want default on attribute trait gets copy of class $self , not meta attribute. want in class: after 'build' => sub { $self = shift; $self->meta->get_attribute('id')->column_name( $self->_unique_key_name ); }; but, want keep attribute trait ro? possible. know mop allows 1 set value of class-attribute, can't figure out how set attribute on meta-attribute. this sounds odd design (why metaclass need instance of class describing?) -- can enough using metaclass of metaclass (remember moose meta classes bootstrapped using mop itself): $self->meta->meta->get_attribute("foo")->default($some_value); also remember defaults need wrapped in coderef if references themselves: $some_value = sub { $instance }; actually, won't

datetime - Basic PHP timezones conversion -

i have looked @ previous questions , nothing seems fit require. i working on scheduling system , client wants add timezones. so need able proform action @ specific date , time. lets chooses have alert @ following date/time: 25-12-2010 13:01:00 + / - timezone i need able store in mysql unix_timestamp, have been looking @ php's datetime , datetimezone has confused me more. i have looked @ strtotime also, unsure of best way work out date/time offset. just make sure we're on same page, want reiterate unix timestamp merely number of seconds since "unix epoch" (january 1, 1970). therefore simple math work on unix timestamps. there 2 ways go this; judging post you're confused you'd use. the first way easiest (and logical) way, , store offset (if have it, is) , multiply 3600 (1 hour in seconds), , add that value current unix timestamp final time of running. another way use datetime , datetimezone classes. how these 2 classes work, s

sql - How to display all the tables with more information (create date, size,...) in a MySQL database? -

searched , searched , gave up. want more info on mysql table or better yet, list of tables in mysql database in descending/ascending order of create date. something : show tables mydb order create_date; donnie's answer did trick : select * information_schema.tables table_schema = 'dbname' order create_time desc; information_schema.tables queryable, doesn't have creation date. show table status return creation date information. can craft table name out of information_schema , call show table status on each.

html - Is margin possible for a <div> in css? -

is possible define margin text area? my wysiwyg editor places text within <div> tags in stead of giving linebreaks <br /> so thought giving <div> margin? is possible in css? , if yes how? many thanks. edit: can't define divs because gets no classes. example editor makes it: <div>lorem ipsum dolor sit amet, consectetur adipiscing elit. vestibulum egestas lacus libero, et pellentesque nisl. cras pharetra nunc sit amet urna vestibulum non ultricies metus malesuada. </div> <div>nulla tincidunt, neque @ blandit ultrices, massa odio pulvinar est, vel accumsan sapien justo sit amet lorem.</div> this looks like: lorem ipsum dolor sit amet, consectetur adipiscing elit. vestibulum egestas lacus libero, et pellentesque nisl. cras pharetra nunc sit amet urna vestibulum non ultricies metus malesuada. nulla tincidunt, neque @ blandit ultrices, massa odio pulvinar est, vel accumsan sapien justo sit amet lorem. but need

windows - python interpreter: interrupt and continue -

after interrupt execution in python interpreter (using ctrl-break in windows), can continue execution? if not, there other way interactively pause execution (so can view variable values), , continue? i prefer not use debugger because it's slower normal execution. i don't know if mean pdb debugger , if don't (and might helpful others here), can try: http://docs.python.org/library/pdb.html here's nice tutorial btw: http://onlamp.com/pub/a/python/2005/09/01/debugger.html

java - Bytecode manipulation to intercept setting the value of a field -

using library asm or cglib , there way add bytecode instructions class execute code whenever value of class field set? for example, let’s have class: public class person { bool dirty; public string name; public date birthdate; public double salary; } let’s section of code contains line: person.name = "joe"; i want instruction intercepted dirty flag set true . know possible setter methods -- person.setname (“joe”) -- class methods can modified bytecode manipulation, want same thing field . is possible, , if so, how ? edit i want avoid modifying code section accesses class, i'm looking way keep interception code part of person class. there pseudo-methods field access, similar properties in python classes? there 2 bytecodes updating fields: putfield , putstatic (see http://java.sun.com/docs/books/jvms/second_edition/html/instructions2.doc11.html ). these found in code using class, there's no

jQuery: specifiying the index of a child <td> in a row's onclick function -

i have click function table row needs pass content of first 2 tds in row. // assign click handler rows $('#supporttables1 tr').click(function () { var firsttd = $(this).find('td').html(); //need next td. below line doesn't work. var secondtd = $(this).find('td')[1].html(); window.open('snglcontactlist.php'+'?search_word='+firsttd+'?list_name=secondtd); }); i can first td fine, i'm stumped on i'm sure profoundly simple matter of accessing second td (i've tried diferrent methods of setting it's index). the array notation [1] returns dom element, not jquery object, can't use .html() (a jquery method) on it. use jquery function .eq() elements instead: // assign click handler rows $('#supporttables1 tr').click(function () { var firsttd = $(this).find('td').eq(0).html(); var secondtd = $(this).find('td').eq(1).html(); window.open(&#