Posts

Showing posts from July, 2012

jaxb - Empty uri in rest response -

i developing plugin nexus oss .my app creates rest call response(to request server) . when server receives , throws error follows javax.xml.bind.unmarshalexception: unexpected element (uri:"", local:"com.collabnet.teamforge.ia.types.getconfigurationparametersresponse"). expected elements \lt{http://www.collab.net/teamforge/integratedapp}createprojectconfigurationrequest\gt, \lt{http://www.collab.net/teamforge/integratedapp}getconfigurationparametersrequest\gt, \lt{http://www.collab.net/teamforge/integratedapp}getconfigurationparametersresponse\gt, \lt{http://www.collab.net/teamforge/integratedapp}getpagecomponentparametersrequest> i guess reason behind exception response doesn't match expected because uri ( guess , if it's wrong please correct me),that namespace in response not set . snip of code in plugin follows @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { "configurationparameter" }) @x...

python - As Django databrowse is deprecated in django 1.4, is there a better way for databrowsing? -

from this question , know django.contrib.databrowse unable set custom queryset (like filter in django.admin). think way of databrowse inspect model , create inline table automatically awesome (in django.admin, i'll have write own tabularinline class each model manually, quite suffering). my question is: django databrowse deprecated in django 1.4, there better way(for example, databrowse library) same task? and recommended use django admin or django databrowse make web interface users browse data? here's same app else adopted since deprecation django: https://github.com/alir3z4/django-databrowse it's available on pypi too;)

SugarCRM - Will workflow works during importing of files? -

i ask if there relationship between workflow , importing of files. for example, execution of workflow occurs when record saved, , applies updated records. , action update field on target module if specific field changed. example, field updated yes if field b changed. so works well, when manually saved module after updating field b. how during importing? workflow still matter? provided conditions met. i hope me on this. need update our ts if there's need hard coding support this. actually have posted on sugar forums. :d thanks much! workflows triggered before_save logic hook. logic hooks triggered anytime save() function called creating records via import process calls the save() function. so, yes, importing records trigger workflows.

unable to set hidden field content from div html content on fullscreen iPad Mobile Safari -

thanks spending time read this i have form call js function copy html content of div hidden form field can submit form. works fine on desktop webkit broswers , on mobile safari on ipad. when run application in fullscreen mode (by saving shortcut on home screen), not work. here's code js function: function update_script_in()//copies scripts , submits form { $("#script_in").html($("#scriptcontent").html()); $('#resiform').submit(); } form submission: <input type=submit value="submit" onclick="update_script_in()"> thanks help this quite old, after googling around solve same issue me, have not found solution. looks weird behaviour ipad (easily reproducible, no way fix, @ least found): target input field gets changed indeed, posted value original 1 (???) so in case workaround useful somebody, instead of applying changes contenteditable div on form submit, apply changes whenever div changed (no on ...

javascript - how to get size or count the number of properties of an object? -

this question has answer here: how efficiently count number of keys/properties of object in javascript? 15 answers is there method count number of properties (or size) of object (don't want use loop) ? suppose have object obj as, obj={id:'0a12',name:'nishant',phone:'mobile'}; then there method results 3 in case ? object.keys returns array containing names of object's own enumerable properties , so: var count = object.keys(obj).length; note there may loop involved (within object.keys ), @ least it's within javascript engine. object.keys added es5, older browsers may not have (it can "shimmed," though; search "es5 shim" options). note that's not quite same list of properties for-in iterates, for-in includes properties inherited prototype. i don't believe there's way list of ...

android - How can i Handle special kind of exception in doinBackground() method -

i making android app requires fetch information remote server , therefore have make http request in async task.now problem that response take more 2 secs , when give http timeout exception of time works fine .so want implement functionality when recieve http timeout exception want retry request again(try doinbackground again,because network call can made in thread other main thread) because chances successful , things need fetched remote server occur in callremoteserver() method now in program have implemented new asynctask<void, void, void>() { private boolean httpresponseok = true; @override protected void doinbackground(void... params) { try { callremoteserver(); } } catch (exception e) { httpresponseok = false; e.printstacktrace(); } return null; } @override protected v...

ruby on rails - What is Spree Deface::Override :original keyword? -

in spree deface::override :original keyword used ? working on apps not begining , got struck code here: deface::override.new(:virtual_path => "....", :name => "admin_user_acct_sales_row", :insert_bottom => "[data-hook='admin_users_index_rows'], #admin_users_index_rows[data-hook]", :partial => "spree/admin/users/...", :original => "90406d8cbc733e601bb9717b4b5711e43fe181a3", :disabled => false) here :original stands what? thanks. following found in spree/deface readme :original - string containing original markup being overridden. if supplied deface log when original markup changes, helps highlight overrides need attention when upgrading versions of source application. warranted :replace overrides. nb: whitespace stripped before comparison. ...

Establish relationship among nodes in Neo4j -

i new neo4j. have customer , product data neo4j. while loading have not established relationship among them. want establish relation among them like: create (customer1)-[:bought]->(item1),(customer1)-[:bought]->(item2); after execute statement says relationship established , when try access like: start n=node(*) match (n)-[:bought]->(items) n.nodename! = "customer1" return items; it says 0 rows. think if establishes relationship should give me 2 items, item1 & item2. any idea? apparently, didn't set nodename customer1 node in creation query. try modify this: create (customer1 { nodename:'customer1' }), (item1 { nodename:'item1' }), (item2 { nodename:'item2' }), (customer1)-[:bought]->(item1), (customer1)-[:bought]->(item2); then second query should return 2 rows expected. update: ok, didn't understand question correctly. so, want establish relationship between existing nodes. try this: start ...

Get the weekday from a Date object or date string using JavaScript -

i have date string in (yyyy-mm-dd) format, how can weekday name it? example: for string "2013-07-31", output "wednesday" for today's date using new date() , output based on current day of week use function, comes date string validation: if include function somewhere in project, // accepts date object or date string recognized date.parse() method function getdayofweek(date) { var dayofweek = new date(date).getday(); return isnan(dayofweek) ? null : ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'][dayofweek]; } you able use anywhere this: getdayofweek("2013-07-31") > "wednesday" getdayofweek(new date()) > // (will return today's day. see demo jsfiddle below...) if invalid date string used, null returned. getdayofweek("~invalid~"); > null valid date strings based on date.parse() method described ...

Same sub-folder names for python imports -

i'm working on collection of python scripts daily work. to avoid duplication, want make use of import share tools. to keep repository maintainable , have sub-folders collect scripts specific purposes , lib-folder in each sub-folder keep shared functions. the structure looks this. root ├── lib │   ├── hello.py └── sub ├── hello_user.py └── lib __init__.py files exist, filtered better readability the code in hello_user.py this: from lib.hello import hello hello() and in hello.py: def hello(): print("hello") pythonpath set root folder . when try execute "python sub/hello_user.py", error "importerror: no module named hello". if rename sub/lib sub/lib_hide, expected output "hello". how python import root/lib instead of root/sub/lib ? setting pythonpath "root/.." , importing "root.lib" work not viable option (would require changes in setups using scripts , in existing scripts). i...

compact framework - Windows Mobile: How to identify and prevent shared DLLs from occupying address space? -

Image
i'm supporting "old" mobile application on wm6 platform. had upgrade new devices because old device isn't available anymore. meant upgrade wm6.1 wm6.5, , .net cf 2.0 3.5. the main problem application constant memory pressure (outofmemoryexceptions). did try fix memory leaks, , optimized code memory consumption. however, on new device whole situation worse on older. understand there 32mb virtual memory limit each process, regardless of how physical memory available ( interesting read ). i used virtualmemory.exe , motorola emscript visualize/analyze 32mb memory slot of application. process virtual memory looks (32mb total, each gray bar represents 1mb, top new device, bottom old device). right of red bar third party dlls (os, vendor, ...). lost 3mb switching new device. it seems application suffering "dll crunch" problem, third party dlls occupy virtual memory addresses on right hand side (highest addresses). note: blue bar on left occupied .exe, ...

Eclipse CDT clean fails on Windows: tries to run rm -rf -

i using juno cdt on windows 7. when try clean project using internal builder or make provided mingw, eclipse runs *x command rm -rf , clean operation fails. log using external builder (mingw32-make) console: 18:08:07 **** clean-only build of configuration debug project threads_example **** mingw32-make clean rm -rf ./main.o ./main.d threads_example process_begin: createprocess(null, rm -rf ./main.o ./main.d threads_example, ...) failed. make (e=2): system cannot find file specified. mingw32-make: [clean] error 2 (ignored) ' ' 18:08:07 build finished (took 137ms) log using internal builder: 10:39:35 **** clean-only build of configuration debug project threads_example **** rm -rf threads_example main.o main.d cannot run program "rm": launching failed error: program "rm" not found in path path=[c:\cs_powerpc\bin;c:/program files (x86)/java/jre7/bin/client;c:/program files (x86)/java /jre7/bin;c:/program files (x86)/java/jre7/lib/i386...

ubuntu - Unable to get maven to download from HTTPS URLs behind proxy -

from dependencies specify in pom.xml , ones use http urls gets downloaded ones use https urls fails saying: severe: proxy authentication error: credentials cannot used ntlm authentication: org.apache.maven.wagon.providers.http.httpclient.auth.usernamepasswordcredentials here contents of settings.xml : <?xml version="1.0" encoding="utf-8"?> <settings xmlns="http://maven.apache.org/settings/1.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/settings/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <plugingroups /> <proxies> <proxy> <id>proxy1</id> <active>true</active> <protocol>http</protocol> <host>proxy.mycompany.com</host> <port>6050</port> <username>domain\username</username> <password>password<...

tfs2012 - Unable to modify TFS Preview's Work Item Templates -

modified tfs preview's wit file, , while saving i'm getting "tf237113: don't have enough permissions complete import operation." error. custom work item types not supported on tf service (formerly tfspreview, known visual studio online). see: http://social.msdn.microsoft.com/forums/vstudio/en-us/075c464e-5870-48cc-a1dc-af863344c51f/create-custom-work-item-field

python - Validate input 16-digit credit card number -

i need validate input string should contain 16 integer digits, no more, no less. how can it? check length using len . use str.isdigit check string contain digits. >>> valid = '1234567890123456' >>> invalid = '1848934798237489324324' >>> len(valid) == 16 , valid.isdigit() true >>> len(invalid) == 16 , invalid.isdigit() false

jquery - JavaScript: function not working without alert() -

possible solution hello, fellow programmers! i writing in order request issue experienced. issue follows: 1) have ajax request, implemented jquery. 2) after returning successful response, script should reload page respective changes , if there validation errors, insert them after hidden field, used store non-critical miscellaneous data. if there validation errors, changes not saved , page reloaded validation error messages. validation taken care of servlet. 3) noticed works fine, when kind of alert() presented before actual appending of error messages, not want have such alert. here javascript code: $('#randomformelement').submit(function() { $(this).ajaxsubmit({ success: function (data, status) { randomfunctiontoreloadthepage(arg1, arg2, arg3); var errors = $(data).find('.classnameoftheerrors').xml(); //alert(something); $(errors).insertafter('#idofthehiddenfield...

How does caching work in openCPU? -

this question directed towards jeroen , follow-up answer: https://stackoverflow.com/a/12482918/177984 jeroen wrote "the server caching" .. "so if enough memory available automatically available memory." how can confirm if object cached 'in-memory' or not? can tell (by performance) of objects being read disk. i'd have things read memory speed data load times. there way view what's in in-memory cache? there way force caching objects in-memory? thanks help. the opencpu project rapidly evolving. things have changed in opencpu 1.0. have @ website latest information: http://www.opencpu.org . the answer cited outdated. indeed caching done on disk. in previous version, opencpu used varnish caching, in-memory. turned out make things more complicated (especially https), , performance bit disappointing (especially in comparison fast disks these days). we're @ nginx caches on disk, more mature , configurable web server, , has other...

c# - how get cookie as method parameter -

i cookie on controller , want pass cookie cheklogin method on login.cs type of cookie on cheklogin public actionresult test() { login.cheklogin(request.cookies["account"]; } checklogin method public static bool cheklogin()// type of cookie { } request.cookies["account"] returns httpcookie , that's type checklogin method take parameter: public static bool cheklogin(httpcookie cookie) { if (cookie != null) { string cookievalue = cookie.value; } } of course if cookie not present in request, request.cookies["account"] return null, make sure take account in cheklogin method. also, ensure not reinventing wheels or opening site security risks, make sure have read forms authentication in asp.net .

c++ - Create a Window in a Visual Studio 2012 console application? -

is there way create window in c++ console application? have console application creating data , want show them in graphics, not inside console. possible? you use function called createwindowex(), see here . it's rather complex, need create wndclassex structure , use registerclassex() on before passing parameter createwindowex(). need create message procedure function. this article on msdn runs through quite nicely

iphone - Calc UICollectionViewCell height while downloading image from internet -

i want create water fall layout using chtcollectionviewwaterfalllayout. noticed in demo cell height fixed , it's in array. but, right now, got image url , want show on screen, height not knowing. so, heightforitematindexpath datasource not working. how calc height of image url before it's downloaded. or can downloading , displaying image in cellforitematindexpath datasource method while calc height , set cell height in heightforitematindexpath datasource method? how that? if image downloaded own server, recommend send meta data first showing image dimensions , use calculate height before downloading image. if image isn't on server, best solution add bool array indicating whether corresponding image downloaded or not, if downloaded, adjust height, if not, use default height. and add delegate cell calls below method when image loaded: - (void) imageloadedatindexpath:(nsindexpath)indexpath { [self.tableview beginupdates]; [self.tableview reloadrow...

embedded - Serial protocol for sending image data -

we have custom-built microcontroller card (st32 / arm cortex m3) has camera attached. camera captures 10-bit greyscale @ 1280x1024 resolution. need send image data pc host on serial. that's quite big chunk of data; @ 115200 baud transfer 3 minutes, assuming goes fine. implement ensure robustness seem slow process down (eg split blocks, checksum blocks, ask resend if corrupt). wondering how people might make compromise between speed , integrity. we seeing real transfer times of 6 minutes. had set uart baud rate @ weird value - 1036800 - because @ 115200 there issues (pc running @ 115200). i'm more software hardware thoughts why might happen helpful! start doing easy compression on image. either run-length encoding or delta encoding give less data send. there better algorithms tiff may want trade off complexity of tiff-ing buffer easier software on embedded side. then can afford simple xmodem compressed data. that has useful property of being standard proto...

php - Wordpress: Fatal error: Call to undefined method Settings::printLinks() -

this error when load of sites one: fatal error: call undefined method settings::printlinks() in /home/admin/server/index.php on line 87 call stack: 0.0001 644544 1. {main}() /home/admin/server/index.php:0 the error showed 2 hours ago caused no obvious reasons... nothing has been moderated cause it. it happened yesterday thousand (or more?) of wordpress users. reasons plugins, disable them all. if still shows, caused theme can change or upload on blog sure

jaxb - XSD for XMI 2.1.1 -

i have parse xmi file (xmi version 2.1.1) using jaxb. for that, have generate java classes corresponding xmi file. need shema definition of xmi file jxc tool. i hope know can find file. in advance ! edit : more informations, there exemple of xmi file (generated using modelio) : <?xml version="1.0" encoding="utf-8"?> <uml:model xmlns:uml="http://schema.omg.org/spec/uml/2.1.1" xmlns:xmi="http://schema.omg.org/spec/xmi/2.1" xmi:version="2.1" xmi:id="_1cua4pm5eekgw-fe2jkgbq" name="test"> <eannotations xmi:id="_1cua4fm5eekgw-fe2jkgbq" source="objing"> <contents xmi:type="uml:property" xmi:id="_1cua4vm5eekgw-fe2jkgbq" name="exporterversion"> <defaultvalue xmi:type="uml:literalstring" xmi:id="_1cua4_m5eekgw-fe2jkgbq" value="2.2"/> </contents> </eannotations> <ownedcomme...

Windows azure web role on local IIS -

i developing windows azure web role. can host azure web role on local iis. if yes..what steps need follow ? local machine running on windows server 2008 r2 there 2 ways achieve that, varying levels of fidelity target environment. the simplest run website project locally. can attach virtual directory on iis , run browser or debug visual studio. run regular iis web application, won't running web role. the second package application cloud service , run under windows azure compute emulator installed on development machine. there several tutorials on how that, including: developing , deploying windows azure cloud services using visual studio - see "debugging windows azure application locally". run windows azure application in compute emulator windows azure basics–compute emulator building web role windows azure email service application - 3 of 5 how-to deploy application windows azure compute emulator csrun the compute emulator simulates several...

symfony - Embedded form persistence : get or create -

i work symfony2 , doctrine. have entity called person. entity related other entities one-to-many relation (as many-to-one unidirectional relation). want each person entity unique (what have done in database using uniqueconstraint annotation). to clear, assume have 2 entities called home , car both have many-to-one relation target entity person. then using forms create or edit entities car , home. in these forms, display embedded form create person entity or select 1 existing. explain : first field of embedded form name of person. user type name of person, list of existing persons displayed (using jquery autocomplete ui) , if user select 1 of them other fields autocompleted. the issue when user submit form existing person, caught integrity error (and know why, because of unique constraint). one of first workaround add id field hidden input in embedded form. user can edit other fields , corrupt current entity. no. another 1 prevent persist in controller if person exist, us...

How to use JavaScript RegExp to resolve relative paths? -

i want implement utility method, can used resolve relative paths. method should implemented using javascript regexp, , algorithm required follows: 1) occurrences of " segment /../", segment complete path segment not equal "..", removed. removal of these path segments performed iteratively, removing leftmost matching pattern on each iteration, until no matching pattern remains. 2) if path ends "/..", complete path segment not equal "..", "/.." removed. examples: a/b/css/../../d ==> a/d a/b/c.ss/../../d ==> a/d a/b/css/../.. ==> a/ a/bss/../../../ ==> ../ ../../../ ==> ../../../ i have tried implement method: var result = "a/b/c.ss/../../d"; while(result.indexof('..') >= 0) { var temp = result.replace(/([^\.\/]*)\/\.\.\/?/,''); if (temp == result){ break; } result...

How to display a dictionary of items in a Listbox on Windows Phone, using C#? -

in here opened word/definition text file. , trimmed putting word newword , definition newdefn . placed in dictionary, created follows: dictionary<string, string> d = new dictionary<string, string>(); which declared global. since inside while(!endofstream) loop, words , definitions stored there. my problem how put values in dictionary listbox . code: public search() { initializecomponent(); stream txtstream = application.getresourcestream(new uri("/panoramaapp1;component/word.txt", urikind.relative)).stream; using (streamreader sr = new streamreader(txtstream)) { string jon; //definition.text = sr.readtoend(); while (!sr.endofstream) { jon = sr.readline(); newword = (word.trim(new char[] { '-',' ' })); newdefn = (defn.trim(new char[] { '-',...

android - Implementing an Action Bar: ABSherlock or ABCompat? -

the application has tabulations , bar custom made (by previous guy) fragments copy cat apple design. i want move toward android action bar provide android experience , usual behavior. should implement action bar sherlock or action bar compat? pro abs: lots of documentation action bar tabs known (that's need do) about holo theme? abs great support it, how perform abcompat? pro abcompat: supported google (better in long run?) better connection navigation drawer (but not use one) no external dependencies in java build path what others arguments decide? which 1 should pick ? from point of view, provided succeed action bar fixed tabs, action bar compatibility best choice (but not much). thank helping me! (even providing arguments missed) the main reason made me switch actionbarcompat menu appearence in devices android <= 2.3. actionbarsherlock, menu appears ugly, default menu of device. actionbarcompat, menu appears same way appears when ope...

c# - WCF Timeouts larger than configured -

i have configured wcf these timeouts: public static nettcpbinding maketcpbinding(bool isclient) { return new nettcpbinding(securitymode.none, false) { hostnamecomparisonmode = hostnamecomparisonmode.strongwildcard, transactionflow = false, portsharingenabled = true, security = {transport = {clientcredentialtype = tcpclientcredentialtype.none}}, receivetimeout = isclient ? timespan.fromseconds(5) : timespan.fromdays(1), sendtimeout = isclient ? timespan.fromseconds(1) : timespan.fromseconds(5), opentimeout = timespan.fromseconds(1), closetimeout = timespan.fromseconds(5), maxreceivedmessagesize = int.maxvalue, listenbacklog = int.maxvalue, maxbuffersize = int.maxvalue, maxbufferpoolsize = 524288, readerquotas = { maxarraylength = int.maxvalue, maxstringcontentlength = int.maxvalue, maxdepth = int.maxvalue, maxbyte...

python - How to Normalize similarity measures from Wordnet -

i trying calculate semantic similarity between 2 words. using wordnet-based similarity measures i.e resnik measure(res), lin measure(lin), jiang , conrath measure(jnc) , banerjee , pederson measure(bnp). to that, using nltk , wordnet 3.0. next, want combine similarity values obtained different measure. need normalize similarity values measure give values between 0 , 1, while others give values greater 1. so, question how normalize similarity values obtained different measures. extra detail on trying do: have set of words. calculate pairwise similarity between words. , remove words not correlated other words in set. how normalize single measure let's consider single arbitrary similarity measure m , take arbitrary word w . define m = m(w,w) . m takes maximum possible value of m . let's define mn normalized measure m . for 2 words w, u can compute mn(w, u) = m(w, u) / m . it's easy see if m takes non-negative values, mn takes values in [0, 1]...

iphone - iOS Core Bluetooth Not asking for Pair -

in recent project, need communicate hardware (bluetooth low energy).i have implement delegate methods code. able connect hardware , device, not getting pairing alert (attached screen shot). why not asking pairing? thank you. #import "btwcentralconnectionmanager.h" @implementation btwcentralconnectionmanager @synthesize cbcmanager; @synthesize discoveredperipheral; @synthesize findmeservicecharacteristic; @synthesize findmeservice; @synthesize delegate=_delegate; static nsstring *kfindmeserviceuuid=@"1802"; static nsstring *kfindmecharacteristicuuid=@"2a06"; static btwcentralconnectionmanager* connectionmanager = nil; +(btwcentralconnectionmanager *)sharedconnectionmanager{ @synchronized(self) { if (!connectionmanager){ connectionmanager=[[self alloc] init]; } return connectionmanager; } return nil; } -(void)findme { byte cod...

javascript - Filter td elements in a tr out, that are not displayed -

i have datatable in asp.net want modifiy. select <tr> rows of datatable jquery: var rows = $("#dginformation tr:gt(0)"); however, <tr> elements have multiple <td> elements , of them marked display:none . how can rows -variable without hidden cells? the purpose of check cells if different each other , 1 line each difference should displayed. if dont filter not displayed elements, compared , have lines, visually same. update works adding css class <td> -elements should hidden. have clean dom-tree (i hope can call way) in firebug. whole function below reference: function filtertable() { var rows = $("#dginformation tr:gt(0)"); var prevrow = null; var counter = 2; rows.each(function (index) { if (prevrow !== null) { var = 1; var changes = 0; $(this).children("td:visible").each(function () { if(i > 2)...

Django Cache Implementation -

well, i'm designing web application using django. application allow users select photo computer system , keep populating onto users timeline. timeline view have list/grid of photos user has uploaded sorted chronologically, showing 50 photos , pull refresh fetch next 50 photos on timeline.the implementation works multiple users. now fast user experience of app i'm considering caching. sites store timeline of user onto cache whenever user logs in first place check information request served out of cache , if not available there go db query information. primarily in 1 line i'm trying cache timelines different users in cache now. i'm done building of webapp minus cache part. , question how cache timelines of different users?? there big difference between public caching , caching of private data. feel data private , needs different strategy. there nice overview of different ways implement testing and, more importantly, different things need take account: ...

c# - Sqlite: appropriate use of commit -

in server application(written in c#) multiple requests come simultaneously , server both read , write operation on sqlite db. now problem when server tries insert database @ time of other request reading database transaction.commit() throwing exception database locked , executenonquery() executing successfully. problem committing database. we committing after every insert , update query. can problem avoid committing once(keep database in memory , commit on application close)? or there other way handle situation. it seems need implement busy callback or busy timeout , sql lite has lock entire database when writing: multiple processes can have same database open @ same time. multiple processes can doing select @ same time. 1 process can making changes database @ moment in time, however. can multiple applications or multiple instances of same application access single database file @ same time?

android - TextView.getLineCount() in custom BaseAdapter -

i need show view when mtxttext has maxlinescount or more lines. checked these questions: first , second what have result in getview method: mtxttext.settext(html.fromhtml(output)); mtxttext.getviewtreeobserver().addongloballayoutlistener( new ongloballayoutlistener() { @suppresswarnings("deprecation") @override public void ongloballayout() { if (build.version.sdk_int < build.version_codes.jelly_bean) { mtxttext.getviewtreeobserver() .removeglobalonlayoutlistener(this); } else { mtxttext.getviewtreeobserver() .removeongloballayoutlistener(this); } if (iscollapseon && mtxttext.getlinecount() >= maxlinescount) { mtxtexpand.setvisibility(view.visible); } else { mtxtexpand....

c# - Converting UTC to local time returns strange result -

Image
i have solution of 3 projects: core outlook add-in asp.net website both, outlook add-in , website use same methods core project data sql server. when write data database, convert datetime values of 2 tables utc time: poll_start poll_end 2013-07-31 12:00:00.000 2013-08-01 12:00:00.000 and pick_date 2013-07-31 12:00:48.000 2013-07-31 13:00:12.000 when data in outlook add-in, correct result : when opening same in website, picks fine: but start , end time "broken" - offset added, bute wrong hours used: here's code converting, both, outlook , website, use: private static void converttolocaltime(poll item) { item.poll_start = item.poll_start.fromutc(); item.poll_end = item.poll_end.fromutc(); } private static void converttolocaltime(pick pick) { if (pick.pick_date != null) pick.pick_date = ((datetime)pick.pick_date).fromutc(); } and implementation of datetime.fromutc() : public static datetime fromutc(this dateti...

html - Divs should not overlap -

i have small problem. webpage i'm working on has 3 areas: on left navigation, should on left side a content area in middle, should in middle of browser the logo area on right side, should in top right corner here's code have right now: css html, body { height: 100%; min-height:100%; padding: 0em; margin: 0em; } body { font-family: segoe ui, arial; font-size: 12px; color: #616a71; line-height: 15px; letter-spacing: 0.5px; overflow-y: scroll; background-color: #ccc; } div#navigation { position: absolute; float: left; width: 220px; left: 5px; top: 70px; z-index: 2; padding-bottom: 50px; background-color: red; } div#content { position: relative; width: 1014px; margin: 0 auto; top: 70px; padding: 10px; background-color: #f6f6f3; box-shadow: 0 0 5px rgba(0,0,0,0.2); border-radius: 2px; line-height: 20px; } div#right { positio...

javascript - Upload files without refreshing the page by using ajax post -

i have page file-upload.jsp code snippet below: <form action="" id="frmupload" name="frmupload" method="post" enctype="multipart/form-data"> <input type="file" id="upload_file" name="upload_file" multiple="" /> <input type="submit" value="update" /> </form> i have 2 questions: the moment select files, i.e onchange event of input type file , file(s) should uploaded. i have java page receives multipart request parameter , uploads file said location. problem form submission onchange , java file can proceed further operations. i googled , went through lot of articles. it's not possible upload files directly via ajax, submit form iframe via ajax/jquery. i tried lot of code internet, such this: $(document).ready(function(){ $('upload_file').change(function(){ var data = new formdata(); data.appen...

docusignapi - Why is the company name in the DocuSign user profile not reflected in recipient email? -

why isn't company name in user profile reflected in email sent signature recipient? seems "account name" shows in email users company name regardless of value set in user profile. what want make use of docusign custom account branding. can control , content of things signing experience, email notifications, , other aspects. have @ account branding guide: docusign custom account branding

haskell - Could not deduce (Show t) -

i have piece of code in haskell refuses compile: data (eq a, num a, show a) => mat = mat {nexp :: int, mat :: qt a} deriving (eq, show) data (eq , show ) => qt = c | q (qt ) (qt ) (qt ) (qt ) deriving (eq, show) cs:: (num t) => mat t -> [t] cs(mat nexp (q b c d)) =(css (nexp-1) c)++(css (nexp-1) b d) css 0 (c a) (c b) = (a-b):[] css nexp (q b c d) (q e f g h) = (zipwith (+) (css (nexp-1) c) (css (nexp-1) e g))++(zipwith (+)(css (nexp-1) b d) (css (nexp-1) f h)) i have error: could not deduce (show t) arising use of `mat' context (num t) bound type signature cs:: num t => mat t -> [t] i searched online , found many similar questions, nothing seems close problem. how can make code work? class constraints on data types don't mean anything. see this related question remove constraint on data type. data mat = mat {nexp :: int, mat :: qt a} deriving (eq, show)

optimization - How Significant Is PHP Function Call Overhead? -

i'm relatively new php , learning idiosyncrasies specific language. 1 thing dinged lot (so i'm told) use many function calls , asked things work around them. here's 2 examples: // change this: } catch (exception $e) { print "it seems error " . $e->getcode() . " occured"; log("error: " . $e->getcode()); } // this: } catch (exception $e) { $code = $e->getcode(); print "it seems error " . $code . " occured"; log("error: " . $code); } 2nd example // change this: $customer->setproducts($products); // this: if (!empty($products)) { $customer->setproducts($products); } in first example find assigning $e->getcode() $code ads slight cognitive overhead; "what's '$code'? ah, it's code exception." whereas second example adds cyclomatic complexity. in both examples find optimization come @ cost of readability , maintainability. is performance increase wor...

Get value in a 2D array in PHP -

i have array: $array = array ( "key1" => "value 1", "key2" => "value 2", "key3" => "value 3", "key4" => "value 4", ... ); i submitting key form, want assign variable value belongs key, example: $key = $_post['key']; $value = ?????; //this need this might simple, haven't done in long time , have forgotten how it. thanks. this should trick: $value = $array[$key]; or without variable: $value = $array[$_post['key']]; if receive notice: undefined index ... should check array before try value with: $value = array_key_exists($_post['key'], $array) ? $array[$_post['key']] : null; this condition checks if key exists. if so, gets value. if not, value of $value null .

exit while loop with user prompt in python -

i've been browsing long time searching answer this. i'm using python 2.7 in unix. i have continuous while loop , need option user interrupt it, , after loop continue. like: while 2 > 1: items in hello: if "world" in items: print "hello" else: print "world" time.sleep(5) here user interrupt loop pressing "u" etc. , modify elements inside loop. i started testing out raw_input, since prompts me out every cycle, it's don't need. i tried methods mentioned here: keyboard input timeout in python couple of times, none of seem work how wish. >>> try: ... print 'ctrl-c end' ... while(true): ... pass ... except keyboardinterrupt, e: ... print 'stopped' ... raise ... ctrl-c end stopped traceback (most recent call last): file "<stdin>", line 2, in <module> keyboardinterrupt >>...

Opening Word Document using VBA in Access 2013 -

i'm using access 2013 , created button on form open word doc instructions. here's code tried: private sub cmdhelp_click() dim wrdapp word.application dim wrddoc word.document dim filepath string set wrdapp = createobject("word.application") wrdapp.visible = true filepath = "c:\...\handout.docx" set wrddoc = wrdapp.documents.open(filepath) end sub the problem is, when try compile error on first line says "user-defined type not defined" please check if set appropriate reference word library in vba environment. to follow path: go vba editor >> menu >> tools >> references >> find on list microsoft word xx.x object library xx.x highest available number >> check >> press ok.

sonarqube - plugin for adding issues referring to manual rules into sonar -

import org.sonar.api.component.resourceperspectives; public class mysensor extends sensor { private final resourceperspectives perspectives; public mysensor(resourceperspectives p) { this.perspectives = p; } public void analyse(project project, sensorcontext context) { resource myresource; // set issuable issuable = perspectives.as(issuable.class, myresource); if (issuable != null) { // can used issue issue = issuable.newissuebuilder() //repository : pmd, key : avoidarrayloops .setrulekey(rulekey.of("pmd", "avoidarrayloops")) .setline(10) .build(); //works issuable.addissue(issue); issue issue2 = issuable.newissuebuilder() //repository : manual, key : performance .setrulekey(rulekey.of("manual", "performan...

handlebars.js - Getting the page URL in a pages collection loop -

im trying build dynamic menu create list of pages per tag. working fine except don't know how page url populated: <section class="see-also"> {{#each tags}} <p>in <span class="tag">{{tag}}</span>:</p> {{#each pages}} <li><a href="#">{{data.title}}</a>{{pages.url}}</li> {{/each}} {{/each}} </section> any suggestions? @luis-martins should able use relative helper destination current page being rendered , destination current page in tags.pages collection generate relative url: <section class="see-also"> {{#each tags}} <p>in <span class="tag">{{tag}}</span>:</p> {{#each pages}} <li><a href="#">{{data.title}}</a>{{relative ../../page.dest dest}}</li> {{/each}} {{/each}} </section> notice the destination of current page being rendered, have use pare...

javascript - jQuery - Get children from index as jQuery object -

[] , .get() both return collection element @ given index native dom element. how can if want retrieve jquery object ? i'm forced convert return value using $() everytime : var $third = $($elements.get(3)); and gets more horrible if have nest it. there kinf of .at() method used way : var $third = $elements.at(3); thanks ! the method looking .eq() var $third = $elements.eq(3);