Posts

Showing posts from August, 2014

How to override search results sort order in Plone -

plone search functionality implemented in plone.app.search package; sort_on variable included in request used control sort order of results on search template . by default, when variable has no value, plone uses relevance sort order. what's easiest way of changing date (newest first) ? you'll need customize search view set new sorting options, , alter default sort when no sort has been set. if still need able sort relevance, use non-empty value change in filter_query method: from plone.app.search.browser import _, search, sortoption class mycustomsearch(search): def filter_query(self, query): query = super(mycustomsearch, self).filter_query(query) if 'sort_on' not in query: # explicitly set sort; if no `sort_on` present, catalog sorts relevance query['sort_on'] = 'effectivedate' query['sort_order'] = 'reverse' elif query['sort_on'] == 'r

c++ - comparing characters causes a bus error -

i'm lost trying figure out runtime error. have struct datatype, , implementation of in array items[] . in struct, there char name defined. i'm reading user input using cin char datatype. i=0; { printf("%c\n", items[i].name); printf("%c\n", itemname); //if ( items[i].name == itemname ) //found=true; i++; } while (i<numofitems || found); if uncomment if statement, printf("%c\n", itemname); seems run thousands of times followed bus error: 10 . note numofitems current 5. output way written: a c b c c c d c e c any idea why can't compare if 1 char equivalent another? your condition should i<numofitems && !found . right now, if either true, keeps looping, , found becomes true on third iteration. i'd rewrite this: for (int = 0; <numitems; ++i) std::cout << items[i].name << '\n'; std::cout << itemname << '\n'; if ( items[i].name == itemname )

my python code is getting a (list index out of range error) ...can anyone get me a reason why -

given below python code supposed read values list , gets sum of values after squaring each of them. def squareeach(nums): in nums[:-1]: s=nums[i]*nums[i] nums[i]=s def sums(num): sum1=1 in num[:-1]: sum1=sum1+num[i] return sum1 def tonumbers(strlist): in range(len(strlist)): strlist[i]=int(strlist[i]) file=raw_input("enter filename: ") openf=open(file,'w') openf.write("1 2 3 4 5 6 7 8 9 10") openf=open(file,'r') s='' in openf: s=i s=string.split(s) in range(len(s)): s[i]=int(i) squareeach(s) s=sums(s) print s this program , getting error. why? python loops iterate on elements (not indices) of list: for in [1, 2, 4]: print # prints 1, 2 , 4 you'll have modify existing 1 working index of each element: def squareeach(nums): in range(len(nums)): nums[i] = nums[i]*nums[i] although make function creates new list instead: def squareeach

xml - Android Layout Text at Left and Image at Right -

Image
i trying to make list image stay on right of layout time. @ same time if there no image subject text fill whole layout. this hope achieve when image hide with image current output: image @ front on text. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:padding="6dip" android:layout_height="?android:attr/listpreferreditemheight"> <textview android:id="@+id/subject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_alignparentbottom="true" android:text="apple orange apple orange apple orange apple orange apple orange apple orange"/> <textview android:id="@+id/cdate"

php - Why is drupal_json only returning page HTML? -

why drupal_json returning page html? here's code: php: //add js function update_ajax_init(){ drupal_add_js("...."); } //function hook menu of me function update_ajax_menu(){ $items = array(); $items['ajax/refresh'] = array( 'type' => menu_callback, 'page callback' => 'ajax_update_node', 'title' => 'ajax update' ); } //function main process return data json function ajax_update_node(){ return drupal_json(array("flag"=>true)); } javascript: $(document).ready(function(){ $("a.update_node").click(function(){ var params = {node_id: $(this).atrr("rel")}; $.ajax( type: "post", url: "ajax/refresh", data: params, datatype: "json", success: function(response){ if (response.flag == true){ alert("success")

Error Using yaml-cpp in ROS? -

i trying use yaml-cpp , according wiki , it's system dependency don't need change cmakelists.txt or manifest.xml. however, when compile code, still errors like: /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:53: undefined reference `yaml::parser::parser(std::basic_istream<char, std::char_traits<char> >&)' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:54: undefined reference `yaml::node::node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference `yaml::node::~node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference `yaml::parser::~parser()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference `yaml::node::~node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference `yaml::parser::~parser()' /home/aramus/fuerte_workspace/sandbox/ima

structure - MySQL table relationship layout (many-to-many with ambiguity) -

i have tables accounts, groups , projects. want describe access privileges of accounts , groups regarding accounts , projects. projects there read, write , no access while accounts there access , no access. the first solution came mind create access table layout: int accessed_account_or_project_id int accessor_account_or_group_id boolean accessed_is_project boolean accessor_is_group boolean canwrite is structure or should create 2 separate tables project , account access privileges or possibly 4 different accessors? i found general advice many-to-many relationships in case uncertain newbie because of ambiguity , canwrite . you shouldn't have column represents 2 different sets of data _or_ , suggest go 4 table solution possible combinations of account/project/group permissions mappings. should make easy enforce constraints prevent conflicts in permissions. the existence of entry in table can indicate access, projects has additional access level. long don

How to set selected item of a DataGrid programmatically in WPF with MVVM application? -

Image
i have bound datatable datagrid control. how can set selected item programmatically ? example in view model have property of type datatable bind datagrid private datatable sizequantitytable; public datatable sizequantitytable { { return sizequantitytable; } set { sizequantitytable = value; notifypropertychanged("sizequantitytable"); } } my xaml <datagrid itemssource="{binding sizequantitytable}" autogeneratecolumns="true" margin="0,0,0,120" /> the constructor of view model (assigning dummy values) this.sizequantitytable = new datatable(); datacolumn sizequantitycolumn = new datacolumn(); sizequantitycolumn.columnname = "size quantity"; this.sizequantitytable.columns.add(sizequantitycolumn); datacolumn scolumn = new datacolumn(); scolumn.columnname = "s"; this.sizequa

Is it common to show UML class diagrams for each module in a system? -

for project of mine, have show uml class diagram. however, system largely gui based, making class diagram huge , messy. common break diagram system such several diagrams, 1 each module? it not common, recommended. and if fear lose global vision, can global cross-module diagram, important classes (which "hearts" of various modules), , module-scoped diagrams.

php - file is not uploading into server in android -

iam uploading image file server while uploading in server in android displaying error message. <!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>404 not found</title> </head><body> <h1>not found</h1> <p>your browser sent request server not understand.<br /></p> <p>additionally, 404 not found error encountered while trying use errordocument handle request.</p> </body></html> my php code <?php header('content-type: text/xml'); include_once('registration_db_con.php'); $content='<?xml version="1.0" encoding="utf-8"?><kudos_image><photos>'; $filename=basename($_files['uploaded_file']['name']); // print_r ($filename); $poto_title=explode(".",$filename); $ext = pathinfo($filename, pathinfo_extension); $r = mysql_query("show table status 'photo

R: newick tree from list of lists -

i working on create newick tree out of list of childs. have list of lists list name parent name , list element childs. here example: $`825` [1] 824 $`824` [1] 823 $`823` [1] 822 $`822` [1] 821 $`821` [1] 820 777 $`820` [1] 819 816 789 787 785 783 $`789` [1] 788 $`787` [1] 786 $`785` [1] 784 $`783` [1] 782 $`777` [1] 776 hence output want phylo tree in newick format follows: 825(824(823(822(821(820(819,816,789(788),787,785(784),783(782)),777(776))))) what best way this? 1 way write recursive function traverses in depth first order , creates tree. in r recursions known bad. thanks. if looking pre-canned solution believe bioconductor/ape library has list -> newick converter http://www.r-phylo.org/wiki/howto/inputtingtrees otherwise, wrote code while ago did neighbour-joining algorithm; it's extremely terse (written in tight deadline), perhaps help. https://github.com/rgrannell1/nj/blob/master/main.r hope helps somewhat

c++ - Can I JBT compile code on Windows RT and Windows Phone 8 -

i have done bit of reading jit compiling code because want port , emulator windows phone 8 , windows rt have noticed microsoft has disallowed virtualprotect() , related apis neccessary execute block of memory containing compiled code. therefor thought might possible compile code before needs launched , save storage. question though, possible execute external code on storage , if not, possible program expand new binaries executable on next launch. if above won't work there way can compile code on device , able execute it. also struggling find reading material on matter if not have answer atleast rever me relevant reading material. thanks. i not sure if after possible check out microsoft's touchdevelop (if haven't done already). allows create apps, via scripts, can run on pretty of devices (windows phones, pc, ipad, iphone, android, & mac). don't know if can directly incorporate apps or not may give ideas. microsoft research page touchdevelop

android - How to strech the rectangle shaped image in the four corners? -

my requirment need select image group of people , need select person or persons , need crop particular selected part of image ,for took rectangle shaped transparent image ,and place rectangle shaped image on actual image want crop , screwed up,i want rectangle image streched pulling @ corners , select actual image ,can 1 me how strech image pulling @ corners i think need draw bitmap canvas , manage user interactions there. can stretch images size in canvas using canvas.drawbitmapmesh(bitmap, 1, 1, vertices, 0, null, 0, paint); change vertices accordingly. see docs the best way creating custom view , override ondraw , drawing here.

android - Data Filter in list view through spinner -

Image
this question has answer here: filter list view edit text 1 answer i want filter data in list-view when select class spinner. sample project or link related this, please provide me. i have data in format. in advance. you can check these: search in listview or custom listview filters . also,from requirements, autocompletetextview more suitable spinner.

Git sparse checkout for simple web deployment -

i have directory structure this: ../dir1/dev/project1/... /project2/... /project3/... /production/ i have dev (and sub directories) checked git (and github). working well. i use github deploy project2 checking out (or pulling, or whatever) production directory. (and specifically, want check out tag.) result in ../dir1/production/project2 i'm not git expert have read bunch online , seems 'sparse checkout' i'm after. i've tried various combinations of instructions here , here , here . basically did: mkdir <repo> && cd <repo> git init git remote add –f <name> <url> git config core.sparsecheckout true echo /project2/ >> .git/info/sparse-checkout when git pull <remote> tagname fatal: remote end hung unexpectedly . when git checkout tagname error: sparse checkout leaves no entry on working directory . what doing wrong? aha - solved it. problem doing init creating em

highcharts - highstock grouping without zoom -

can use highstock following: grouping days, weeks, months, display data. is, make button group, did not zoom, , group data (do approximation). this how can update datagrouping: $("#container").highcharts().series[0].update({ datagrouping: { units: [ ['year', [1]] ] } }); and jsfiddle: http://jsfiddle.net/w7rtl/1/

kinect - Fastest Speech recognition library C++ -

i know general question topic, still want know whats fastest speech recognition library in c++? currently using microsoft sapi kniect. works fine , recognizes words abit slow, times takes 1,2 seconds recognize word , in case lag causing alot of interaction issues user. i checked sample provided kinect, in turtle moves left right according words recognized thats bit slow. so wondering if there faster library sapi, can used in cases robot using voice recognition "left" "right" robot keeps moving left , turns right after 1,2 seconds bit frustrating user. the issue not being fast, proper way use api. speech recognition time-consuming process main trick start recognition of audio as it's recorded , in parallel recording. moment phrase end spoken have results , can react immediately. the response time of 0.2 seconds can achieved way, need more flexible api implement this. choice cmusphinx , open source speech recognition framework can use implemen

exception - java.lang.ClassNotFoundException:com.mysql.jdbc.Driver -

i'm getting exception java.lang.classnotfoundexception when trying run code, my code try { class.forname("com.mysql.jdbc.driver"); connection con=drivermanager.getconnection("jdbc:mysql://localhost:3306/simple", "root","root"); statement stmt=con.createstatement(); string query="select * cust"; resultset rs=stmt.executequery(query); while(rs.next()) { system.out.print(rs.getstring("cust_name") +" "); system.out.print(rs.getstring(2) +" "); system.out.print(rs.getstring(3) +" "); } rs.close(); stmt.close(); con.close(); } catch (classnotfoundexception e) { e.printstacktrace(); } catch (sqlexception e) { e.printstacktrace(); } i'm getting error java.lang.classnotfoundexception: com.mysql.jdbc.driver @ java.net.urlclassloader$1.run(urlcl

osx - Link error when compile mex files -

i running mex under matlab r2011a in os x 10.8. compiling process ok. come link errors. command line used in matlab command window is: mex -i/usr/include/ -l/usr/lib/ -o -ddebug -dfastplog calcentropyscalesopt.c hists.c the original command line runs in ms windows mex -o -ddebug -dfastplog calcentropyscalesopt.c hists.c i add -i , -l options fix errors. link errors still exist: undefined symbols architecture x86_64: "_mxcreatedoublematrix_700", referenced from: _do_calcsalscale1daa in calcentropyscalesopt.o _do_calcsalscale3d in calcentropyscalesopt.o _do_calcsalscale2d in calcentropyscalesopt.o _do_calcsalscale1dparzen in calcentropyscalesopt.o _do_calcsalscale1d in calcentropyscalesopt.o "_mxcreatenumericarray_700", referenced from: _aacirclepix in calcentropyscalesopt.o _circlepix2 in calcentropyscalesopt.o ... many more ... ld: symbol(s) not found architecture x86_64 collect2: ld returned 1 exit status mex: link of ' "calc

Return a value present in loop in java -

i want return value loop. code follows: public long findlocationid(string location) throws systemexception { long locid = 1; list<location> locationlist = locationlocalserviceutil.getlocations(-1,-1); for(location findloc : locationlist) { if(location == findloc.getlocationname()) { locid = findloc.getlocationid(); **return locid;** } } } when try put return value in loop error saying include return statement. how should change code can return value loop itself? i want return new locid value in loop , not value set locid = 1; want return new value of locid loop there various approach problem. use while loop use loop additional stop condition use break key word. let first create template before introduce our logic: public long findlocationid(string locationname) throws systemexception { if(locationname == null) {

jquery - How to select select more than one date from calendar -

i new wordpress .i m using jquery ui widgets plugin select date jquery calendar.but want select more 1 date in calendar .can me how it.any other plugins that. thanks this jquery code jquery(document).ready(function() { jquery('#pre-select-dates').multidatespicker({ dateformat : 'dd-mm-yy' }); }); can 1 me this..... highlighted day have 1px yellow border hardly visible, added red color it. http://jsfiddle.net/tfmkj/ probably works you, cannot see it. selected day have class ui-state-highlight

javascript - waiting GetJSON async to finish -

i have simple javascript code splistitems sharepoint using rest , populates dropdown list. want apply bootstap style on once dropdown populated. how can determine population of dropdown done/finsihed. can apply style on dropdown items. function populatedropdown(dropdownid, splist) { var url = "http://devportal/formsrepository/_vti_bin/listdata.svc/" + splist; var dropdowncontrol = $('#' + dropdownid); $.getjson(url, function (data) { $.each(data.d.results, function (key, value) { dropdowncontrol.append( $('<option></option>').val(key).html(value.title) ); }); }); } //this lines work dropdown not populated yet $('.combobox').combobox(); your time , appreciated. cheers why not place $('.combobox').combobox(); after $.each loop?

Hide Fragment inside framelayout in android -

i got stuck small issue have shown fragment inside framelayout without problem when trying hide fragment, doesn't hide , remain shown in layout. here have done : fragment fragment = new footerclass(); fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); to show fragment ft.setcustomanimations(r.anim.slide_left_in, r.anim.slide_left_out).show(fragment).replace(r.id.footer_layout, fragment).commit(); to hide fragment ft.setcustomanimations(r.anim.slide_left_out, r.anim.slide_left_in).hide(fragment).commit(); it showing not hiding me out

printing - Old printer text format c# -

i have following output generated unix machine 1996... upgrading software windows, , need create exact output http://pastebin.com/ybhpsydw c# there problems can't handle, because don't know how... how can determinate columns, set aligment "importe" column right, if plaintext? i have done output in excel more readable, flexible.. want creepy old stuff because lot of reasons , i'll become insane working people, don't want upgrade anything, software keep every old creepy thing @ output... so if knows way this, it'll helpful, thank you. edit output list of data sql server, old data stored multivalue .dat , .idx files, they're in sql server... basically, code generates values following var query = getrows(sel.datatable).select(row => { return new { banco = row["banco"].tostring(), emisora = row["emisora"].tostring(), sucursal = row["sucursal"].tostring(), fecha = row

java - Run JSTL code stored into database field -

i want generate dynamic pages fields stored database. if store html code database when print code jsp page code rendered navigator. when store jstl code database , code not rendered servlet. field in database : <h1>hello<c:out value="world"><c:/out></h1> jsp code : <c:out value="${module.content}"> navigator response : hello html source code : <h1>hello<c:out value="world"><c:/out></h1> so jstl code stored database not rendered servlet. is there option store jstl code database rendered bi servlet? thanks in advance. jsp files "compiled" , transformed java class file, each value received jsp data, , cannot added part of source code. think trying equivalent this: string s=" + b"; int a=1; int b=1; system.out.println("s"); //it won't show "2"

image processing - Power Spectrum (Conjugate Matrix Multiplication) in Matlab : Getting complex values instead of real ones. What is wrong with my code? -

here's code, simple can't believe doesn't work. pckint = imread('pckint.jpg'); f = fft2(pckint); fcon = conj(f); s = f*fcon; now, per assignment directions, , understanding of subject, should real values in power spectrum 's'. however, getting complex values. i sorry complete noob when comes matlab, have tried searching , understanding commands have used no avail. please help! you can apply elementwise multiplication (i,j)th element multiplied (i,j)th element: s = f.*fcon;

html - CSS hover disable nested table -

i have problem css :hover class. how disable second table :hover class inside second row. here fiddle html <table border="0" width="100%" id="product-table"> <tr> <td colspan="2">title of table</td> </tr> <tr> <td width="20%"><b>text text</b></td> <td>someting product</td> </tr> <tr> <td><b>text text</b></td> <td> <table border="0" width="100%"> <thead> <tr bgcolor="#ddd"> <td colspan="6"><strong>title of inside</strong></td> </tr> <tr bgcolor="#efefef"> <td width="20%"><strong>no</strong></td> <td width="20%"><strong>date</s

javascript - need help on this toggle for little change -

in code below want when click on content inside panel (content contained in p tags within panel), should not slidup panel, till click on panel or elsewhere used not child elements p inside panels, see html in fiddle , click try should not close panel if click event on other used. script helped me mr praveen earlier. the code is $(document).ready(function () { $("#toggle li > .panel").hide(); $('.plusminus').html('+'); $('#toggle li').click(function () { if( !$(this).children('.panel').is(":visible") ) { $("#toggle li > .panel").slideup(); $('.plusminus').html('+'); } = $(this).children(".plusminus"); $(this).children(".panel").slidetoggle('fast', function(){ a.html($(this).is(":visible") ? '--' : '+'); }); }); $("body").click(function(e

Inno Setup silent install UAC -

i trying construct silent install using inno setup. using /silent , /verysilent command parameters, , works fine, except uac window popping @ start. how around issue? i have found few posts loosely mentioning using signtool, other sources have said change uac box blue publisher parameter filled. can here? scenario installer distributed on internet update existing software on machine silently without user interaction. to run setup elevated without uac prompt, need run elevated. defeat entire point of uac if programs elevate without user controlling access. signing executable show publisher.

ios - How to play a video in landscape mode but app support only portrait mode? -

i making application support portrait mode.here iam loading youtube videos in uiwebview. when switch landscape mode video has play in landscape mode also. after taping on done of videoplayer. view controller changing landscape mode has in portrait mode here webview code web=[[uiwebview alloc]initwithframe:cgrectmake(2,0, 140, 99)]; web.backgroundcolor=[uicolor redcolor]; [web setdatadetectortypes: uidatadetectortypenone]; nsstring *embedhtml = @"<iframe title=\"youtube video player\" width=\"320\" height=\"460\" scrolling=\"no\" src=\"http://www.youtube.com/embed/%@?modestbranding=1&amp;rel=0;autoplay=1;showinfo=0;loop=1;autohide=1\" frameborder=\"0\" allowfullscreen allowtransparency=\"true\"></iframe>"; nsstring *htmlstr = [nsstring stringwithformat:embedhtml, [youtubeid_array objectatindex:i]]; web.tag=i+100;

logging - C++ wstring to file instead of string -

i have simple logger class tried turn accepting , outputting wstrings instead strings. header: #include <fstream> using namespace std; class clog { public: clog(wstring filename); ~clog(); void writestring(string ustring); private: fstream m_stream; }; cpp: #include "stdafx.h"; #include "log.h"; clog::clog(wstring upath) { m_stream.open(upath); } void clog::writestring(string ustring) { m_stream << ustring.c_str() << endl; } clog::~clog() { m_stream.close(); } can suggest should use instead of fstream? tried using wstringstream, did not have .open output file, thought wrong approach. i keep behaviour writes file. i use "wofstream" instead of "fstream" now, , works perfectly.

sql left outer join order by column in left table but preserve all rows -

i have following: select table1.id table1 left outer join table2 on table2.table1_id = table1.id (table1.entry_id=2) , parent_id=0 order sum(table2.column1) - sum(table2.column2) works fine until add 'order by', need relevant rows table1, if have unmatched rows in table2, ordering place them @ bottom. try instead: select t1.id table1 t1 left outer join ( select table1_id, sum(column1) sum1, sum(column2) sum2 table2 group table1_id ) t2 on t2.table1_id = t.id , t1.entry_id = 2 , t1.parent_id = 0 order t2.sum1 - t2.sum2;

java - upload a file to SalesForce programatically -

i build flow create case in salesforce. now, trying upload file case programatically. client uploads file manually in server. question how upload java rest based web service. have links describe topic. first try read documents below: see following: http://www.salesforce.com/in/?ir=1 api doc: http://www.salesforce.com/us/developer/docs/api/content/sforce_api_objects_document.htm examples: http://login.salesforce.com/help/doc/en/fields_useful_field_validation_formulas.htm the following code allows upload physical file salesforce.com , attach record. code: try { file f = new file("c:\java\test.docx"); inputstream = new fileinputstream(f); byte[] inbuff = new byte[(int)f.length()]; is.read(inbuff); attachment attach = new attachment(); attach.setbody(inbuff); attach.setname("test.docx"); attach.setisprivate(false); // attach object in sfdc attach.se

iphone - I am capturing image by this code and i have to record video also how to do that? -

* i capturing image code have record video on clicking button , save please tell me should do? not getting because have captured image , save photo album have record video , store please 1 give me better idea * - (void)viewdidload { front=no; self.modaltransitionstyle = uimodaltransitionstylecoververtical; barpicker.value = hue; pickerarr=[[nsarray alloc]initwithobjects:@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10", nil]; flashlighton=yes; [flashbutton setimage:[uiimage imagenamed:@"off.png"] forstate:uicontrolstatenormal]; [camrabutton setimage:[uiimage imagenamed:@"camra.png"] forstate:uicontrolstatenormal]; session = [[avcapturesession alloc] init]; session.sessionpreset = avcapturesessionpresetmedium; calayer *viewlayer = self.vimagepreview.layer; avcapturevideopreviewlayer *capturevideopreviewlayer = [[avcapturevideoprev

Python HTTP 599: Connection closed (Tornado) -

i'm getting error: http 599: connection closed [e 130405 11:43:14 web:1031] uncaught exception /networks/1/sensors/1/alarm (127.0.0.1) while executing following code: from tornado.stack_context import exceptionstackcontext def handle_exc(*args): print('exception occured') return true @tornado.gen.engine def check_status_changes(netid, sensid): como_url = "".join(['http://131.114.52:44444/ztc?netid=', str(netid), '&sensid=', str(sensid), '&start=-5s&end=-1s']) http_client = asynchttpclient() response = yield tornado.gen.task(http_client.fetch, como_url) if response.error not none: print("terzo") print response.error exceptionstackcontext(handle_exc): response.rethrow() else: print('handle request') line in response.body.split("\n"): if line != "": #net

php arrayObj insensitive to undegined index -

how make arrayobj in insensitive undefined index, need use undefined index example in logging $this->log['some']['other']['info']++ here try: class arrayinsensitive extends \arrayobject{ var $data = array(); public function offsetget($name) { if(!array_key_exists($name,$this->data)) $this->data[$name]=new arrayinsensitive(); return $this->data[$name]; } public function offsetset($name, $value) { $this->data[$name] = $value; } public function offsetexists($name) { return (array_key_exists($name,$this->data)); } public function offsetunset($name) { unset($this->data[$name]); } } how ? just force specific case whenever reference index value class arrayinsensitive extends \arrayobject{ var $data = array(); public function offsetget($name) { if(!array_key_exists(strtolower($name),$this->data)) $this->data[strtolower($nam

javascript - How to get feature geometry? -

i have drawfeature control in openlayers app: draw=new openlayers.control.drawfeature(markers,openlayers.handler.point, { "title": "poi", "displayclass": "olcontroldrawpoi" }) app.mappanel.map.addcontrol(draw); its work fine. want window created feature's geometry , attributes edit them. how can make it?

c# - Binding on key withing a custom class -

is possible bind on key within custom class possible dictionary ? i can bind dictionary binding: "binding mydictionary[mykey]" but don´t want use dictionary custom class this: public class datagridfield : inotifypropertychanged { [required] [key] public string key { get; set; } private object value; public object value { { return this.value; } set { this.value = value; this.onpropertychanged("value"); } } } now want access objects of class within observablecollection same way dictionary . there way achieve this? you can, have implement indexer property : public class datagridfield { public string this[string index] { { return this.key; } set { this.key = index; } } } edit: but if interested in having dictionary inotifyproperty/collectionchange implementation, can

google tv - How to implement smooth streaming? -

i read https://developers.google.com/tv/android/articles/hls?hl=en , not understand meaning " adaptive streaming - automatically adapts either congestion or bandwidth availability ."? works when player starts, or wile playing too? in practice video starts quality according current bandwidth; exmaple .m3u8 file contains list of links , bandwidths: #extm3u #ext-x-stream-inf:program-id=1, bandwidth=1950000 http://link1.m3u8 #ext-x-stream-inf:program-id=1, bandwidth=1500000 http://link2.m3u8 #ext-x-stream-inf:program-id=1, bandwidth=1200000 http://link3.m3u8 #ext-x-stream-inf:program-id=1, bandwidth=950000 http://link4.m3u8 #ext-x-stream-inf:program-id=1, bandwidth=800000 http://link5.m3u8 #ext-x-stream-inf:program-id=1, bandwidth=700000 http://link6.m3u8 for example current bandwidth 1600000, player (videoview) starts playing video link 2. while playing, bandwidth becomes 900000 player still continues play video link 2 buffering delays. is player works correctly, or

reportviewer - SSRS - Disabling export options (eg. PDF) for individual reports -

we have many reports use on website. while exporting reports pdf, file size gets huge , server crashes due load. great if can disable export pdf option problematic reports. so there way disable export options (example: export pdf) in report viewer 9.0 (ssrs), individual reports? thank you. just in case nobody else said out loud before here or in linked articles: the neatiest global solution find rendering engines in rs config file (mine sits in: c:\program files\microsoft sql server\msrs12.mssqlserver\reporting services\reportserver\rsreportserver.config ), go xml key: extensions > render , insert following property @ end of each entry want hide: visible="false" example: <extension name="xml" type="microsoft.reportingservices.rendering.datarenderer.xmldatareport,microsoft.reportingservices.datarendering" visible="false" /> alternatively put <!-- , --> (html comment markers) @ beginning , end o

java - OData4j query using basic authentication -

first, let me start saying have got absolutely nothing working odata4j. i building android app (using eclipse) needs consume odata web service, have ipad app work fine think it's safe the web services ok. all of web requests require basic authentication work, , able make calls using browser confirm url , credentials using valid. so far have code: odataconsumer.builder builder = odataconsumers.newbuilder(url); builder.setclientbehaviors(new basicauthenticationbehavior(loginusername, loginpassword)); odataconsumer c = builder.build(); for(oentity entity : c.getentities("entry").execute()){ system.out.println(entity.getproperty("name").getvalue().tostring()); } currently, eclipse debugger fails on for line, presumable during .execute() call. debugger 0 me, line looks half-relevant in logcat is: edit : after @johnspurlock's answer, got little further. same problem overall, new error message: badrequestexception: request uri not

sql - Two COUNT to one SELECT -

can tell me how can these 2 count 1 select please? /*pocet treninku ucast*/ select jmeno, count(ucast) hraci inner join ucast_trenink2 on ucast_trenink2.id_hrace_ucast=hraci.idhrace inner join seznam_treninku on seznam_treninku.id_treninku=ucast_trenink2.id_treninku_ucast inner join kategorie on kategorie.idkategorie=seznam_treninku.kategorie (ucast='true')and(kategorie.idkategorie = 1) , datum >= '1/1/2013' , datum < '9/1/2014' group jmeno; /*pocet treninku neucast*/ select jmeno, count(ucast) hraci inner join ucast_trenink2 on ucast_trenink2.id_hrace_ucast=hraci.idhrace inner join seznam_treninku on seznam_treninku.id_treninku=ucast_trenink2.id_treninku_ucast inner join kategorie on kategorie.idkategorie=seznam_treninku.kategorie (ucast='false')and(kategorie.idkategorie = 1) , datum >= '1/1/2013' , datum < '9/1/2014' group jmeno; thanks lot you can use this: select jmeno, sum(case when ucas

mongodb - How to define a query which returns all documents with a same field -

i create query checking documents in database have same field value. e.g. got 100 documents stored , 2 of them looks this: document 1: { "_id":32143242, "specialfield":12 } document 2: { "_id":787878, "specialfield":12 } so how 2 documents if don't know ids or specialfield-value? this grouping operation can performed using mongodb aggregation framework . sample data > db.foo.find().pretty(); { "_id" : objectid("515ead9c7bb40c6a51b16a68"), "value" : 12 } { "_id" : objectid("515ead9d7bb40c6a51b16a69"), "value" : 12 } { "_id" : objectid("515ead9f7bb40c6a51b16a6a"), "value" : 14 } { "_id" : objectid("515eada07bb40c6a51b16a6b"), "value" : 8 } sample grouping operation > db.foo.aggregate({$group : { _id: "$value", count : {$sum : 1}, ids: { $addtos

delphi - How to access TFrame's canvas? -

using: delphi xe2, vcl 32-bit application, windows 8 i'm trying paint background of frame onto panel (i'm using tjvpanel, because exposes onpaint event) child control of frame. after reading this post , adding canvas field, still not successful. after calling showaddreceiptpanel, should draw frame's (tfrmmyframe) window contents controls on (which include grid , pagecontrol) on foreground panel, grayscaled, after being processed proeffectimage method, instead shows opaque white background. missing something? here's code: type tfrmmyframe = class(tframe) pnlhdr: tpanel; pnladdnewbg: tjvpanel; procedure pnladdnewbgpaint(sender: tobject); private { private declarations } fbgimg: tproeffectimage; fcnvs: tcanvas; procedure paintwindow(dc: hdc); override; procedure showaddreceiptpanel; procedure hideaddreceiptpanel; procedure resizepanel_pnladdnewbg; public { public declarations } constructor create(aowner

c# - Calculate changeset for object -

i'm writing windows store app receives object (custom type created) server, lets user edit object , submits "changeset" server. changeset object of same type received object every field set null except fields user edited. fields contain user's edits so: original case: description: "cracked exhaust pipe" status: "open" customer: "" mileage: 10000 edited case: description: "" status "open" customer: "example inc." mileage: 10000 case changeset: description: "" status: null customer: "example inc." mileage: null when app first downloads object server make copy of later comparison. user makes changes 1 of objects , when user submits changes, changeset of these 2 objects calculated generic method calculatechangeset . goes through every property of 2 objects , compares them equality: public static t calculatechangeset<t>(t oldobj

qt - Where can I find QtMobility package for downloading? -

i cannot find package of qtmobilty, links found in internet invalid. please help? need install under windows(i need qtconnectivity library). did try qtmobility@gitorious ? although can't "install" - have build it.

c# - Call a .asmx web Service from another .asmx web service -

can call web service web service. i have tried adding web reference , getting below erro system.configuration.configurationerrorsexception caught message=the current configuration system not support user-scoped settings. source=system baremessage=the current configuration system not support user-scoped settings. line=0 stacktrace: @ system.configuration.localfilesettingsprovider.getpropertyvalues(settingscontext context, settingspropertycollection properties) @ system.configuration.settingsbase.getpropertiesfromprovider(settingsprovider provider) @ system.configuration.settingsbase.getpropertyvaluebyname(string propertyname) @ system.configuration.settingsbase.get_item(string propertyname) @ system.configuration.applicationsettingsbase.getpropertyvalue(string propertyname) @ system.configuration.applicationsettingsbase.get_item(string propertyname) pls help extract methods separate class. , access common methods cla

swing - Moving files in java -

so far code move selected file path define later in code how path selcted file import java.awt.component; import javax.swing.jfilechooser; public class copyfileexample { public static void main(string[] args) { final jfilechooser fc = new jfilechooser(); component acomponent = null; int returnval = fc.showopendialog(acomponent); } } you can selected file way: if (returnval == jfilechooser.approve_option) { file file = fc.getselectedfile(); ... } else { // means user closed dialog or pressed cancel }

java - Is it possible to get the phone's currently selected profile? -

the stock cyanogenmod rom has support profiles baked in , although i'm not sure if part of default android functionality, wondering if possible name of selected profile. i haven't been able find developer documentation on this. (assuming android sdk doesn't support this, can superuser app implement functionality?) thanks trudging through cm source found source code profilemanager . methods public guess don't need go down rabbit-hole of java reflection...but in order use these classes, need cyanogenmod jars build against. got it. bit of ugly reflection , voila. classes profilemanager , profile object o = getsystemservice("profile"); try { class<?> profilemanager = class.forname("android.app.profilemanager"); class<?> profile = class.forname("android.app.profile"); try { method getactiveprofile = profilemanager.getdeclaredmethod("getactiveprofile", n

c# - check whether username exists or not -

i have registration page when user enters email id, being "verified whether registered user or not". i tried writing code in textchange event of textbox did not work. during runtime not calls textchange event of textbox. obj.localconnection_class(con); cmd = new sqlcommand(); cmd.connection = con; cmd.commandtext = "select count(*) subscriber_master emailid ='" + txtemail.text + "'"; dr = cmd.executereader(); dr.read(); can tell me how can make work. you need set textbox autopostback property true <asp:textbox id="txtcheck" runat="server" autopostback="true" ontextchanged="txtcheck_textchanged"></asp:textbox> hope works you.

ruby on rails - query in mongoid search in multiple condition -

my model this def self.search(search) if search self.full_text_search(search) else scoped end end but need add also self.or({start_date: /#{regexp.escape(search)}/i},{end_date: /#{regexp.escape(search)}/i}) in above search . how join 2 condition in above search. 2 query works fine independently. need make them join together. working example helpful you can join 2 mongoid criterias using merge method: q1 = self.scope q2 = self.or(...) result = q1.merge(q2) here relevant documentation: http://rdoc.info/github/mongoid/mongoid/master/mongoid/criteria#merge-instance_method

java - Linked list problems on multithreaded program -

this 1 of homework questions: what problems using linkedlist on multithreaded program, alternative? i answered follows , appreciate other advices: the problem lack of concurrency - in order use linked list have use lock on changes made internal objects holds relaible (since every object holds reference next object), once lock linked list 'shutting down' options use multiple threads, alternative array since can lock every item seperatly. i'm totally not sure on answer, advices?... your answer looks good. alternatives copyonwritearraylist (assuming list suffices) if iterations far exceed mutations.

InDesign SDK : Can I use the SDK without installing InDesign? -

first, let me clarify question. dealing indesign documents , trying extract information it. read somewhere adobe indesign loads documents , dynamically calculates metadata information not present in .indd or .idml files. for use case, need write software loads indesign file , extracts information - without loss. can done using adobe's indesign sdk, without having indesign software installed? thanks. i doubt if can -> there many functions fetch indd file information dynamically indesign app itself. such information not part of indesign file. for idml files, idml files view , not model. not contain enough information used offline without app. if your's minimal app , need information indesign document, it's fine otherwise idml not of help.