Posts

Showing posts from March, 2013

Android Emulator: Can not connect to internet for some apps behind proxy -

purpose: access application in emulator through proxy what did: launched emulator , set burp proxy in emulator network setting. can access net in browser , of application (flipkart, imdb) through proxy. in burp set "ca signed per host certificate" ssl setting i'm using: adb 1.0.31, android emulator version 22.0.4.0 problem: of application asks authentication first (like evernote, lookout etc) error occurs saying "there's problem in internet connection" is problem because of ssl certificate or else.

sql - Multiple statements in WITH oracle -

how execute multiple statement using data prepared with . example: with t1 ( ....using table ), t2 ( ....using t1 , other tables ), t3 ( ..using t1 , t2 , other tables ) statement 1; (let using t1 , t2) statement 2; (let using t2 , t3) how can in oracle? a subquery factoring clause ( with clause) part of single query, acts single-use view. if find need repeat select statements in with clause on multiple queries may want consider defining views each select in subquery factoring clause simplify code. share , enjoy.

php - query not perfect to get the required results.? -

mytable-:every 10 seconds data inserted in table depending on page clicked( x,y,z ) page | time | string| timestamp x | 0 | load | 2013-07-24 18:45:02 x | 10 | 0 | 2013-07-24 18:45:12 x | 20 | 0 | 2013-07-24 18:45:22 y | 0 | load | 2013-07-24 18:45:25 x | 30 | 0 | 2013-07-24 18:45:32 y | 10 | 0 | 2013-07-24 18:45:35 z | 0 | load | 2013-07-24 18:45:40 x | 40 | 0 | 2013-07-24 18:45:42 y | 20 | 0 | 2013-07-24 18:45:45 z | 10 | 0 | 2013-07-24 18:45:50 x | 50 | 0 | 2013-07-24 18:45:52 y | 30 | 0 | 2013-07-24 18:45:55 x | 0 | load | 2013-07-24 18:45:58 z | 20 | 0 | 2013-07-24 18:46:00 x | 10 | 0 | 2013-07-24 18:46:08 y | 40 | 0 | 2013-07-24 18:46:05 this trying return query. x,50 //x page has max time of 50 sec y,40 //y page has max time of 40 sec z,20 x,10 //if groupby,i dont parameter. * note: *no of rows returned equal no. of

Syntax error while comparing timestamps in PostgreSQL -

error: "syntax error @ or near interval" join in question: ... left outer join usersession e on a.userid = e.userid , e.lastaction >= now() interval '-4h' * 1" lastaction created lastaction timestamp null default null the idea is, return nils if session's timestamp 4 hours older current time. no idea deal here, never had compare timestamps before either. if want records last 4 hours need: now() - interval '4 hours' instead of now() interval '-4h' * 1

timing - How to get a millisecond precision uptime from user-space in Linux? -

i'm working on raspberry pi based project has gps module boss wants me time system clock. need take readings on different sensors whilst gps may not have fix, , need know millisecond precision (tolerance of 50-100ms fine) when these readings taken. personally want hardware rtc this, i've been instructed work around it. idea mark each reading relative time system boot, system time not reliable, , updated ntp/satellite time when available (i can fix-up records when synchronized time available using relative time). so, how can millisecond precise uptime in linux user-space c code? jiffies value available in kernel perfect. i think have check main controller(cpu) on board. usually, there hardware timer module integrated cpu, or decrementer register implementation in cpu core. if there hardware timer or dec register on cpu, use implement periodical interrupt(the frequency can 1000hz or else). interrupt handler can notify/wakeup user-space process necessary real-ti

java - Time picker stops working after date picker is added -

i'm building app displays date picker , time picker on click of 2 seperate buttons. first added in time picker , working fine, proceeded add date picker works fine. problem here being when added in date picker, casused time picker stop working. know both work , i'm 90% sure because of structure of code being i'm new android , java development can't work out i'm going wrong. appreciated. thanks code below: package com.cam.datetime; import java.util.calendar; import android.app.activity; import android.app.alertdialog; import android.app.datepickerdialog; import android.app.dialog; import android.app.timepickerdialog; import android.app.timepickerdialog.ontimesetlistener; import android.content.dialoginterface; import android.content.intent; import android.content.pm.activityinfo; import android.os.bundle; import android.telephony.smsmanager; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widge

java - Reading a SOAP message from a TCP socket's stream using SAAJ -

i send , receive soap message using saaj api between tcp server , client. can write tcp socket using soapmessage class using method writeto writing stream how read soap message tcp stream? class/method might useful? you can use javax.xml.ws.endpoint , here example @webserviceprovider @servicemode(mode.message) public class soapserver implements provider<soapmessage> { public soapmessage invoke(soapmessage request) { ... process request , create response return response; } public static void main(string[] args) throws exception { endpoint.publish("http://localhost:1111/test", new soapserver()); } } send request ... url endpoint = new url("http://localhost:1111/test"); soapmessage response = connection.call(message, endpoint); ...

java - Beginner: Do while loop issue -

ello, got minor issue haven't got clue on what's going wrong... snippet of code: do{ string third = joptionpane.showinputdialog(null, "please enter year ["+day+"/"+month+"/yy?]"); year = integer.parseint (third); validchoice = validyear(year); }while(!validchoice); do{ string gous = joptionpane.showinputdialog(null, "do want switch format us? [y/n]"); gous = gous.touppercase(); char conversion = gous.charat(0); validchoice = validoption(conversion); switch(conversion){ case 'y': if(year < 10) { date.append(month).append("/").append(day).append("/" + "200").append(year); }else{ date.append(month).append("/").append(day).append("/" + "20").append(year); } joptionpane.showmessagedialog(null, date

prototype - Does JavaScript Object initialization time depends on number of Variables and function? -

ques 1: take more time initialize javascript object if has large number of variables , functions? ques 2: large javascript(.js) file size performance issue? for instance: creating javascript object using prototype, sample code below: function simpleobject(){ // no variables , functions attached } function rootobject(){ var 1 = "one"; var 2 = "two"; . . var one_thousand = "one thousand"; } function child_1_object(){ // n number of variables } . . function child_1000_object(){ // n number of variables } rootobject.prototype.get_child_1_object = function(){ return new child_1_object(); } . . rootobject.prototype.get_child_1000_object = function(){ return new child_1000_object(); } all above code in 1 .js file has 10k lines of code(10kloc). question when create object of rootobject take more time comparing creation of simpleobject ? question one: making object more complicated, members, functions et

c++ - how to write and read points to binary file? -

i've programmed code in c++ of ball moves in space (3d points). have movements positions. mean, path points passed. i have write positions\points binary file , read in order restore movements\path. example, if move ball , right, i'll want save positions passed can read them , draw ball moves same, restore path. i saw example binary file doesn't me: // reading complete binary file #include <iostream> #include <fstream> using namespace std; ifstream::pos_type size; char * memblock; int main () { ifstream file ("example.bin", ios::in|ios::binary|ios::ate); if (file.is_open()) { size = file.tellg(); memblock = new char [size]; file.seekg (0, ios::beg); file.read (memblock, size); file.close(); cout << "the complete file content in memory"; delete[] memblock; } else cout << "unable open file"; return 0; } does create file automatically? where? , writ

jquery - how to apply div on hover my table td -

this html table code: <table border='1px'> <tr> <td id='td'>first</td> <td>last</td> <tr> <td id='td'>newfirst</td> <td>newsecond</td> </table> and here 1 div this. <div class="not_editable id-left" >not editable</div> i create div when hover on table tr first td want show on them div. , hover on second td dont show. here css create div title label. <style> .not_editable { position: relative; background-color: #292929; width: 100px; height: 30px; line-height: 30px; /* vertically center */ color: white; text-align: center; border-radius: 10px; font-family: sans-serif; } .not_editable:after { content: ''; position: absolute; width: 0; height: 0; border: 15px solid; } .id-left:after { border-right-color: #292929; top: 50%; right: 95%; margin-top: -15px; } </style> jsfiddle http://jsfidd

ios - How to add an image below the cell.backgroundview in iphone? -

i had application in using image background of cell in iphone.i doing cell.backgroundview = [ [[uiimageview alloc] initwithimage:[[uiimage imagenamed:@"chat_cell1.png"] resizableimagewithcapinsets:uiedgeinsetsmake(6,39,15,60)] ]autorelease]; now adding image content view same cell.its small image.i need show image close background view part of background view above image.i need bellow background view.` [[cell contentview] insertsubview:imageview belowsubview:cell.backgroundview]; [[cell contentview]sendsubviewtoback:imageview]; `but still showing above background view.can me on this? create single uiview containing both background image , new image view. set background view container.

iphone - Image Sharing Using Google Plus in ios -

i want share image on google plus: i have used google+ api appdelegate.m [gppsignin sharedinstance].clientid = @"myclientid"; [gppdeeplink setdelegate:self]; [gppdeeplink readdeeplinkafterinstall]; and on button action viewcontroller.m id<gppsharebuilder> sharebuilder = [[gppshare sharedinstance] sharedialog]; [sharebuilder seturltoshare:[nsurl urlwithstring:@"http://dummy.com"]]; [sharebuilder settitle:@"some title" description:@"some description" thumbnailurl:[nsurl urlwithstring:@"http://dummy.com/image"]]; [sharebuilder setcontentdeeplinkid:@"myclientid"]; [sharebuilder open]; but on click crashes ans error shows: -[__nsdictionarym gtm_httpargumentsstring]: unrecognized selector sent instance 0x1e887ea0' it crashes on [sharebuilder open] it because dont have set other linker flag , go build setting , other linker flags: -objc

date - Combine SUB_DATE AND TIMEDIFF to substract 1 hour in mysql -

Image
i'm having problems timediff , date_sub . here mysql query: select id, clock_user_id, clock_date, (select clock_time aura_clock aura_clock.clock_type = 'start' , aura_clock.clock_date = t1.clock_date) start, (select clock_time aura_clock aura_clock.clock_type = 'stop' , aura_clock.clock_date = t1.clock_date) stop, the problem start here timediff((select clock_time aura_clock t t.clock_date = t1.clock_date , t.clock_time > t1.clock_time order t.clock_time limit 1), min(clock_time)) spent aura_clock t1 t1.clock_date >= date_sub(date_sub(curdate(), interval weekday(curdate()) day),interval 15 day) , t1.clock_date < date_sub(curdate(),interval dayofweek(curdate()) + 6 day) group clock_date the result : now, want subtract 1 hour time spent using date_sub didn't work. as mirkobrankovic wrote: ((timediff((select clock_time aura_clock t t.clock_date = t1.clock_date , t.clock_time > t1.clock_time order t.cloc

MongoDb runs only with mongod but not with mongo -

after ran mongorestore mongo service fail start automatically, if open terminal , run mongod service running perfectlly. if close terminal get. suggestions? error: couldn't connect server 127.0.0.1 shell/mongo.js:79 when i'm running mongod get: mongodb starting : pid=1875 port=27017 dbpath=/data/db/ 64-bit thu jul 25 12:16:40 [initandlisten] db version v1.8.2, pdfile version 4.5 thu jul 25 12:16:40 [initandlisten] git version: nogitversion thu jul 25 12:16:40 [initandlisten] build sys info: linux allspice 2.6.24-28-server #1 smp wed aug 18 21:17:51 utc 2010 x86_64 boost_lib_version=1_46_1 thu jul 25 12:16:40 [initandlisten] * warning: spider monkey build without utf8 support. consider rebuilding utf8 support thu jul 25 12:16:40 [initandlisten] waiting connections on port 27017 thu jul 25 12:16:40 [websvr] web admin interface listening on port 28017 thu jul 25 12:17:05 [initandlisten] connection accepted 127.0.0.1:38257 #1 well, there&

java - Creating a sesame repository from eclipse connecting to the http server -

i can connect localhost:8080/openrdf-sesame/ , create new repository sesame console . using tomcat server fine that. can connect localhost:8080/openrdf-workbench/ , display/delete repositories but when type localhost:8080/openrdf-sesame/ browser, getting error. why? can't access existing repository eclipse giving localhost:8080/openrdf-sesame/ httprepository . import rdf jar's project no problem that my java code: string sesameserver = "http://localhost:8080/openrdf-sesame"; string repositoryid = "1001"; repository repo = new httprepository(sesameserver, repositoryid); repo.initialize(); the repository id '1001' existing in repository. can see workbench. the eclipse says millions(!) of lines error type: ... 15:18:51.843 [main] debug o.a.commons.httpclient.httpclient - operating system version: 3.5.0-23-generic ...

android - Reference another dimen in dimen -

is possible use reference of dimension resource in dimension? mean this: file dimen.xml : <dimen name="test1">18sp</dimen> <dimen name="test2">@dimen/test1</dimen> it works way posted <dimen name="test1">18sp</dimen> <dimen name="test2">@dimen/test1</dimen>

android - Nullpointerexception while updating UI -

i'm reading records database , loading them in listview . listview consist checkbox , textview . loading done on asynctask . part of application works fine. the next step automatically checking checkboxes according flags database , here problem. i'm trying check items inside onpostexecute() , error nullpointerexception . if same from, example, setonclicklistener() of button widget works fine. the question how check if listview populated, checkboxes , textview loaded , visible on screen? i don't know if part of code program breaks looks like: (j=0; j<3; j++) { linearlayout itemlayout = (linearlayout)listview.getchildat(j); // find under linearlayout checkbox checkbox = (checkbox)itemlayout.findviewbyid(r.id.colchk); (k=0; k<rbmjere.size(); k++) { if (checkbox.gettag().tostring() == rbmjere.get(k).tostring()) { checkbox.setchecked(true); } }

Ant, separating warnings and errors -

while compiling using ant, java application gives more 1000 warnings (mainly deprecated api related legacy code) , difficult find error message(s) mixed thousands of warnings messaged in log. i tried suppressing warnings passing arguments in ant javac task, didn't work. is there options separate warnings , errors in log, warnings first , errors? the warnings displayed javac, ant forwarding them console. ant cannot distinguish them between javac warnings , errors. can configure javac warning output. can use attribute 'nowarn' in javac tasks. <javac nowarn='on' .... /> you can select warning let suppress. have javac documentation (look @ xlint options), , use 'compilerarg' element of javac task. <javac .... > <compilerarg line="-xlint:-deprecation"/> </javac>

asp.net mvc 4 - MVC 4 Binding to a dictionary -

i have looked around on internet, none of solutions seem work me. i have following view model: public class configsviewmodel { // ios dictionary public dictionary<string, object> iosdictionary { get; set; } // android dictionary public dictionary<string, object> androiddictionary { get; set; } } the values in these dictionaries either bool or strings. want display table editing view, , want bind these dictionaries. view looks this: @model mobilerebrandingtool.models.viewmodels.configsviewmodel <div> @using (html.beginform("saveappconfig", "project", "post")) { <table class="config-table"> <tr> <th></th> <th>ios</th> <th>android</th> </tr> @foreach (var kvp in model.iosdictionary) { <tr> <

Redmine 2 Plugin routes -

i create plugin redmine 2. how can use custom url in 'link_to' ? plugins/my_plugin/config/routes.rb: redmineapp::application.routes.draw match 'issue/:issue_id/something/:action/:id', to: 'something#new_some' end actually, see url in 'rake routes', when try use on view, see 'no route matches' exception. you need define route this: redmineapp::application.routes.draw match 'issue/:issue_id/something/:action/:id', to: 'something#new_some', as: 'fancy_route' end after make register route: project_module :my_plugin permission :fancy_route, { :my_plugin => [:my_plugin] },:public => true end

c++ - How to use Qt widgets in a plugin for a Gtkmm based application? -

i develop gtkmm based application, can extended through plugin mecanism. each plugin must define show() method void myextension::show() { // here code of extension } i trying develop plugin uses qt widgets. newbie in qt, tried following simple code: void myextension::show() { int argc = 1; char argv1[] = "myapp"; char* argv[] = { argv1, null }; qapplication app(argc, argv); qmessagebox::question(null, "title", "what?", qmessagebox::yes|qmessagebox::no); app.exec(); app.exit(); } this source code builds perfectly, first execution of plugin ok (the dialog box shown), after first execution of plugin, qapplication seems perturb gtk event loop. messages ones: gtk-critical **: ia__gtk_container_add: assertion `gtk_is_container (container)' failed gtk-critical **: ia__gtk_widget_realize: assertion `gtk_widget_anchored (widget) || gtk_is_invisible (widget)' failed and application crashes on third or fourth execution of pl

java - Android - how can i onCreate launch the camera without crashing the apps? -

i have problem, first activity window launching second activity window need directly see cam preview > take snap shot > show preview on activity window. now, way need launch (expected , correct way of user demand), after taking picture , coming window apps crash on way. @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); this.imageview = (imageview)this.findviewbyid(r.id.picture); button photobutton = (button) this.findviewbyid(r.id.capture_btn); //photobutton.setonclicklistener(new view.onclicklistener() { //@override //public void onclick(view v) { intent cameraintent = new intent(android.provider.mediastore.action_image_capture); startactivityforresult(cameraintent, camera_request); // } //}); } but way not crash, in way wrong use case, cause becomes 2 button press apps. public clas

java - Implement SimplePager with DataGrid and AsyncDataProvider -

how implement simplepager asyncdataprovider when data grid provided values fectched server. you have create class extending asyncdataprovider . in class can override onrangechanged -method. my class example looks this: public class asynclistprovidervisit extends asyncdataprovider<myobject> { @override protected void onrangechanged(hasdata<myobject> display) { // new range. final range range = display.getvisiblerange(); /* * query data asynchronously. if using database, can * make rpc call here. we'll use timer simulate delay. */ final int start = range.getstart(); int length = range.getlength(); service.util.getinstance().getpartofimmoobjects(start, length, new asynccallback<list<myobject>>() { @override public void onfailure(throwable caught) { confirmationpanel cp = new confirmationpanel(); cp.conf

indexing - Solving a forced oscillator equation with a time-dependant force in MATLAB -

i solve following problem in matlab my problem classic forced damped harmonic oscillator, issue force putting oscillator motion time-dependant computed matlab (with pdepe). therefore, when use ode45 solver, have following error : attempted access param.te(1.00004,10); index must positive integer or logical. i have skipped issue in matlab odefunction writing dy(1)=1/param.m.*param.te(floor(t+1),10)-param.nu.*x(1)-param.wo2.*x(2); dy(2)=x(1); instead of dy(1)=1/param.m.*param.te(t+1,10)-param.nu.*x(1)-param.wo2.*x(2); dy(2)=x(1); however, 'dirty' , poor approximation of function, , know if way obtain better range of datas function, perhaps extrapolating values, i'm bit lost here... thanks :) ps: it's first post on site, if have forgotten in topic, please me.

c# - Replace single chars in string at position x -

this question has answer here: how set character @ index in string in c#? 5 answers i doing simple hangman game. have gotten going except part user enters correct char , corresponding char in solution word should replaced former. first, here code: private void checkifletterisinword(char letter) { if (currentword != string.empty) { if (this.currentword.contains(letter)) { list<int> indices = new list<int>(); (int x = 0; x < currentword.length; x++) { if (currentword[x] == letter) { indices.add(x); } } this.enteredrightletter(letter, indices); } else { this.enteredwrongletter(); } } } private void enteredrightletter(char letter, list<int> indices

c# - Use of SPSite and SPWeb in a custom Sharepoint web service -

i current coding custom web service sharepoint 2010 site. code designed copy contents of 1 folder on sharepoint. currently, code uses 'spsite(sourceurl).openweb()' access spweb object site. however, code crashes , gives me following error the web application @ 'sourceurl' not found. verify have typed url correctly. if url should serving existing content, system administrator may need add new request url mapping intended application. in code, sourceurl url of main site formatted " https://sitename.com ". thanks help, scott edit: here method causes error: public void copyfoldercontents(string sourceurl, string folderurl, string destinationurl) { using (spweb owebsite = new spsite(sourceurl).openweb()) { spfolder ofolder = owebsite.getfolder(folderurl); //create list of files (not folders) on current level spfilecollection collfile = ofolder.files; //copy files on current

ruby on rails - Elasticsearch hide attribute tire -

the results sent elasticsearch contain attributes generic elasticsearch. example of json returned rails server. { locality_name: "some text", locality_details: "some text", _score: null, _type: "locality", _index: "localities", _version: null, sort: [ 1.0860322703674736 ], highlight: null, _explanation: null } as can observe,the major content of result being transferred occupied default attributes of elasticsearch such _score,_sort,_explanation. i believe suppressing behaviour result in lower size of json object being returned in result , hence improvement in performance. elasticsearch provide such functionality? how tire incorporate functionality? i think looking fields parameter: http://www.elasticsearch.org/guide/reference/api/search/fields/

Intellij like Text Editor -

i intellij user , used , it's keymap (all kinds of goodies text: ctrl+w, alt+mousedrag...). looking text editor programming familiar intellij way of work (in sense). in ideal world, similar keymap default or have plugin. second best thing having keymap "very compatible" intellij when set keymap manually. mean that, often, best stick tool's keymap, because designed in diferent way, example, when coming eclipse intellij, tried use eclipses bindings, came conclusion intellij not designed work way missing lot , things not transferable @ all. i willing pay. what have tried/trying: notepad++ - overal good, annoying (unsaved files, kinds of popups, search), no inline spell-checker. sublime text - started trying. nice has spell-checker, overall seems nice, no annoying popups. seems deal breaker - has complex keymap itself, bindings not possible (some toggle "on/off: functionality). seems overriding keymap require lot of effort , in , missing lot of sublime f

jquery - Autocomplete Directive in ng-repeat loop Angular -

i have question angular heads. fighting on problem autocomplete custom directive. autocompletes events loaded in directive etc. for reasons have put autocomplete input field in each line of <table> element. for that, use ng-repeat attribute. none of autocomplete fields working. when remove ng-repeat attribute, autocompletes working... so question is, there known bug this? thank you you need transclude directive. because directive nested in ng-repeat contents of directive not being compiled dom, hence not working. directives have transclude attribute , coupled ng-transclude tag allow directives work when nested in ng-repeat some resources started: this article great starter directives , has nice introduction transclusion. here source giving examples of transclude , compile in ng-repeat.

asp.net - Can https fallback to http and security level of https -

i considering installing ssl/tls domain. there 2 questions have been bothering me: is there scenario https connection can fallback http? so, e.g. if ajax looks this $.post("https://foo.com", function(){ }); is there chance change $.post("http://foo.com", function(){ }); and if domain still accesible @ http://foo.com ? next have read extensively using ssl/tls , have read seems accurate assume if have enabled , if send user credentials in plain text, it's still secure (there encryption salt , on server of course). extent true , creating hash on client , sending on https more secure? update : if sending plaintext on ssl secure enough, point of using things cnonce ? isn't unnecessary overhead on client? no, https never falls http automatically. take deliberate action user. if you're going web page putting url address bar, easy; form submission it's harder. yes, sending plain text on ssl fine. in fact, sending hashed pas

ajax - asp.net checkbox custom validation -

i trying make website using asp.net dynamic data entities , need checkbox in website must checked in order insert new record. having trouble validating checkbox. have tried server side custom validators people have postes on website aome reason aren't working..any clue on if implementation different if dynamic data entity application? these different things have tried far: attempt 1: made new class: [attributeusage(attributetargets.property, allowmultiple = false, inherited = false)] public class mustbetrueattribute : validationattribute { public override bool isvalid(object value) { return value != null && value bool && (bool)value; } } and called metadata file in following way: [mustbetrue(errormessage="error")] public bool checkbox12 { get; set; } that doesn't work. then tried else: attempt 2: on aspx page: <asp:dynamiccontrol id="mycheckbox" runat="server" datafield="checkb

c# - How do I display query results in the same order they were made in a multithreaded web app? -

i asked here on using multithreading in simple asp.net windows forms applet make searches run faster, , got answers. result of using threading on app (and not having experience it), i've run number of new design problems. i've written simple applet sends post request third party website use search bar, , return integer extracted string on page indicates how many results found given search term. public partial class _default : system.web.ui.page { private nlsearch search; private static list<searchresult> resultslist = new list<searchresult>(); protected void page_load(object sender, eventargs e) { search = new nlsearch(); } protected void addsearchmethod(object sender, eventargs e) { var text = searchform.text; task task = task.factory.startnew(() => makerequest(text)); task.wait(); resultslabel.text = ""; foreach (var v in resultslist) { results

vb.net - Missing Microsoft.Web.Administartion in .net 4.5 -

my project set .net4.5 , odd reason not able import above namespace in doesnt seem exist. i have dlls inside intsrv folders , dont have option of changing proj type. idea how proceed ? you need add these dll's references in solution. solution explorer -> add reference microsoft.web.management microsoft.web.administration

hibernate - Spring Data JPA sorting on nested collection -

i have following domain objects: @entity public class item { @id @generatedvalue(strategy = generationtype.auto) private long id; private string name; @onetomany private list<propertydefinition> propertydefinitions; } @entity public class propertydefinition { @id private long id; private final string name; private final string value; } i sort items example "title" named propertydefinition.value how spring data jpa? iterable<item> items = itemrepository.findall(new sort("???")); example code can found here: https://github.com/altfatterz/sort-poc/ any feedback appreciated. you can use jpa or hibernate @orderby annotation: @onetomany @orderby("value asc") // sort value asc private list<propertydefinition> propertydefinitions; otherwise, can create own query sort them criteria or hql query .

uitableview - Loading image from byte array stream in UITableViewCell -

i implementing uitableview custom uitableviewcell. there uiimageview there displaying image. api given , not contain download links of images i'll have show in each uitableviewcell. getting images , i'll need call request returns byte array stream of image shown on corresponding cell. i know , can make image nsdata coming api. not sure how efficient idea , worrying memory , performance issue. , want asynchronous loading in uitableviewcell , image cacheing take less time in later calls. , can efficient approach here ? , suggestion library can me doing great. you need download images on own, in table view controller or model. save on memory space, can resize images. ideally, done on server side save on bandwidth. could, however, resize once downloaded well. remember, retina , non-retina devices have different image resizing needs. either way, cache resized image along other cell data , throw away nsdata. can refresh cell calling reloadrowsatindexpaths:withrowani

android - Andengine Live Wallpaper Galaxy S4 Touch Issues -

i have published live wallpaper andengine , received email saying touch not working on device. did working while previewing wallpaper, when set background touch doesn't work longer. far know, on s4, have tested on s3 , many other devices. here touch code wallpaper. inside oncreatescene method. mscene.settouchareabindingonactiondownenabled(true); sprite buttonsprite = new sprite(279, 618, btntextureregion, getvertexbufferobjectmanager()){ @override public boolean onareatouched(touchevent ptouchevent, float ptoucharealocalx, float ptoucharealocaly) { if(ptouchevent.isactiondown()) { randomspawn(); } return true; } }; mscene.registertoucharea(buttonsprite); mscene.attachchild(buttonsprite); there similar issues s3. samsung overrode teh default behavior of livewallpapers. not scroll, , not receive touch events should. boo, samsu

algorithm - Generate a sorted key for a sorted value -

i need maintain mapping key string value, , mapping value key. need make sure both of these lists sorted @ times. new values can added list @ time. best data structure(s) use when new value added, can maintain 2 sorted lists without having regenerate many keys , without ending unbalanced tree? could described "in problem, out goal maintain linked list explicit label each node such labels monotonic throughout list, subject inserting , deleting @ given location."? this section 3 of http://courses.csail.mit.edu/6.897/spring05/lec/lec24.pdf . show how can maintain table of keys in sorted order, gaps, viewing implicit tree structure, in reorganizing keys within section of table equivalent re-balancing subtree.

php - A div fails to show html when its innerHTML is changed -

my div set show line of text , successfully. later in code set innerhtml of div show 15 lines of text , shows 1st line. i thought block elements divs automatically 'grow' based on content -- , note i'm not using css affect div in 'hiding' overflow. note put 3-pixel-wide solid purple border around div visually assess size change 'innerhtml' 1 line of text 15 lines of text. <div class="rbadslinksdiv" id="adlinksarea" style="border: 3px solid purple;"> <br />this 1 line of text replaced 15 lines of text.... </div> when web page first appears, correctly shows 1 line of text in div: this 1 line of text replaced 15 lines of text.... here css: .rbadslinksdiv { margin-top: 5px; } here php code generates javascript fill div 15 lines of new text: $html = <<<heredoc "<br /><br /><b>1) hey ad links?</b><br /><br />" "<br

java - Android: TabHost and modify value textedit -

good afternoon. i hope can me problem guess caused ignorance of ta b host. it possible have tabhost 3 tabs, visual components same, same id, , give them value selected tab? for example, in 3 tabs have 3 editext called r.id.textnivel1acierto r.id.textnivel1objetivo r.id.textnivel1fallo can have same id in 3 tabs? want 3 textview show different value depending on tab i put code things i've been trying , said did not work wanted, fails when click tab public class resultados extends activity { tabhost tabs; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.resultados); tabs=(tabhost)findviewbyid(android.r.id.tabhost); tabs.setup(); tabhost.tabspec spec=tabs.newtabspec("tabsumas"); spec.setcontent(r.id.tabsumas); spec.setindicator("", this.getresources().getdrawable(r.drawable.boton_suma));

c# - Match vertical slash -

how can match vertical slash | in regular expression i've trying match content "1|2|3|4|" regex expression " (<group1>.*?)|.*?|.*?|(<group2>.*?)| i'd in first group value 1 , in second 4 regular expression not working what have close, remove question marks. asterisks match 0 or more there's not need question marks. the \ escapes |. you're missing couple slashes. should like: (<group1>.*)\|.*\|.*\|(<group2>.*)\| and you'll need add @ sign in front of string declaration c# take literal text. @"backslash\all day"

Is there a way to pass javascript variables in url? -

is there way make below script pass javascript values url of href link? <script type="text/javascript"> function geopreview(lat,long) { var elema = document.getelementbyid("lat").value; var elemb = document.getelementbyid("long").value; window.location.href = "http://www.gorissen.info/pierre/maps/googlemaplocation.php?lat=elema&lon=elemb&setlatlon=set"; } </script> try this: window.location.href = "http://www.gorissen.info/pierre/maps/googlemaplocation.php?lat="+elema+"&lon="+elemb+"&setlatlon=set"; to put variable in string enclose variable in quotes , addition signs this: var myname = "bob"; var mystring = "hi there "+myname+"!"; just remember 1 rule!

JavaScript regex, searching for hashtags -

how can search text , hashtags (alphanumeric , underscore , hyphen) , wrap them in span tags eg search some_string = "this text 3 hashtags #tag1 , #tag-2 , #tag_3 in it" and convert to: "this text 3 hashtags <span>#tag1</span> , <span>#tag-2</span> , <span>#tag_3</span> in it" i've got far: some_string = some_string.replace(/\(#([a-z0-9\-\_]*)/i,"<span>$1</span>"); but 1 fault doesn't include # in wrappings should. seems output: "this text 3 hashtags <span>tag1</span> , #tag-2 , #tag_3 in " also detects first hashtag comes across (eg. #tag1 in sample), should detect all. also need hashtags minimum of 1 character after #. # on own should not match. thanks try replace call: edit: if want skip http://site.com/#tag kind of strings use: var repl = some_string.replace(/(^|\w)(#[a-z\d][\w-]*)/ig, '$1<span>$2</span>');

python - Converting Variables In List to Local Variables -

is there way convert variables in list local variables in python? more specifically, i've been doing x = imp.load_source("test","./test") but don't want have x.var1 i want able var1 reference each imported element. is possible? i'm not sure understand question, , i'm not sure you're trying idea (think of zen of python: "namespaces 1 honking great idea--let's more of those!"). trying load files of python source code , have access local variables? again, going reiterate warning these bad ideas. a. why using imp module? import module normal. take of it's local scope , import local scope: from test import * this classic example of bad python. don't it. every python programmer tell never use _ import *. accomplish you're trying do, you'll override local variables or built-ins , cause obscure bugs. b. use execfile . takes source of file , executes in local scope. so: execfile('./tes

javascript - JS: revealing module pattern - accessing internal objects vs arrays? -

using revealing module pattern, how can provide direct access non-static private variables? here's have: var m = function () { var obj = {}; var arr = []; var change = function () { obj = {"key":"if see this, o reference obj"}; arr.push("if see this, reference arr") }; return { change: change, o: obj, a: arr }; }(); m.change(); console.log(m.a); // prints ["if see this, reference arr"] console.log(m.o); // prints object {}, wanted "if see this, o..." it seems references arr directly, while o settles copy of obj's value @ initialization time. understand behavior if obj string, float, or boolean. i of course expose obj via public get_obj method, i'm still curious if can solved without additional methods (i want keep interface obj intact). furthermore, what's special arrays objects don't have, causes behavior? really grateful insight

vb.net - Crystal activex report viewer with linq -

i want used crystal reports activex viewer linq. dim crxapp new craxddrt.application dim crxreport new craxddrt.report crxreport = crxapp.openreport(application.startuppath & "/report/report_daily.rpt", nothing) dim query = obj_tbl in dbmodeladmin.v_invoicereturnings obj_tbl.invoiceid = 2 select obj_tbl crxreport.database.setdatasource(query) rptdaily.reportsource = crxreport rptdaily.viewreport() when run got data want data condition in query.

php - How to get values passed via GET with ajax -

say have following, , got ids dynamically. <div class="search_results"> <p>user 1 <a href="phpfile.php?id=3">add</a></p> <p>user 1 <a href="phpfile.php?id=4">add</a></p> </div> if didn't use ajax, catch passed values in phpfile.php $_get['id'] , how can use jquery? $.ajax({ type: 'get', url: 'phpfile.php', // how add values here? success: function(data) { // smth } }); you need add data parameter: url: 'phpfile.php', data: {id: 3} if have take id html displayed: $('.search_results a').click(function (e) { e.preventdefault(); $.ajax({ type: 'get', url: 'phpfile.php', data: {id: $(this).attr('href').match(/id=(\d*)/)[1]}, success: function (data) { // } }); });

c# - Applying MahApps.Metro style to NavigationWindow -

has had luck applying mahapps.metro style navigationwindow? have implemented window fine, need apply navigationwindow pages. tried extending navigationwindow , adding modifications metrowindow so, no luck. window has standard title bar , border, , content black. using system; using system.windows; using system.windows.input; using system.windows.interop; using system.windows.media; using system.windows.navigation; using mahapps.metro.native; namespace mahapps.metro.controls { [templatepart(name = part_titlebar, type = typeof(uielement))] [templatepart(name = part_windowcommands, type = typeof(windowcommands))] public class metronavigationwindow : navigationwindow { private const string part_titlebar = "part_titlebar"; private const string part_windowcommands = "part_windowcommands"; public static readonly dependencyproperty showiconontitlebarproperty = dependencyproperty.register("showiconontitlebar", type