Posts

Showing posts from June, 2015

how to see the logs of added module in android project in android studio -

this first time have added module in project. have added android vitamio inside project. things working except play/pause touch listener. code seems written right . have tried putting listener inline no luck. when debug code , execute line line can see code running expected. have put log.d() command inside mediacontroller class track execution none of log command written in class if vitamio module gets printed. wondering if log commands of added modules not printed @ same window main project's log commands do. can 1 please suggest on this. those module logs part of full project. can filter , display specific log if module send it

javascript - Abort XHR on timeout event -

i want abort xhr request on timeout event, it's not working. syntax next: var req = new xmlhttprequest(); req.open('post', url , true); req.timeout = 5000; req.ontimeout = function () { req.abort(); }; so if xhr request not finished in 5 seconds code should abort request. if write req.abort(), xhr request perform.

ios - Difference between instantiateViewControllerWithIdentifier and initWithNibName? -

what difference between instantiateviewcontrollerwithidentifier , initwithnibname , other former storyboard , later not? uistoryboard *signupstory = [uistoryboard storyboardwithname:@"signupstory" bundle:[nsbundle mainbundle]]; signuploginviewcontroller *signupvc = [signupstory instantiateviewcontrollerwithidentifier:@"signupvc"]; and signuploginviewcontroller *signupvc = [[signuploginviewcontroller alloc] initwithnibname:@"signuploginviewcontroller" bundle:[nsbundle mainbundle]]; if you've created ui using storyboards, you'll want call instantiateviewcontrollerwithidentifier . here, identifier not part of view controller used storyboard locate view controller. storyboard handle initialization , call initwithcoder , why need override when creating subclassed view controllers. on other hand, if ui resides in pure .xib file - developers use initwithnibname . does, technically, break encapsulation , there other ways it...

java - Understanding Server-sent Events -

i'm trying update html5 table in real-time data database. here code: html page: <script type="text/javascript"> //check browser support if(typeof(eventsource)!=="undefined") { //create object, passing name , location of server side script var esource = new eventsource("[some address]/api/sse"); //detect message receipt esource.onmessage = function(event) { //write received data page document.getelementbyid("placeholder").innerhtml=table; }; } else { [erro message] } </script> and java restful service: @path("/sse") public class sseresource { @context private uriinfo context; public sseresource() { } @get @produces(ssefeature.server_sent_events) public string getserversentevents() throws exception { someobject o = new someobject(); final string mystring = o.somequery().get...

Android: Retaining data, multiple language support and retaining last applied settings when the app reloads -

i have developed an android app takes text input orientation changes the textview becomes empty. want add multiple language support app through settigs button(settings.xml). is there way fix textview issue , retain last language used in next app launch? e.g. if set french new language settings. next time open app language should french not english(the default language). can me fix this? thank you you need use sharedpreference once setting set 1 language store selected in sharedpreference can use next time. everytime app restarts can check language set. for orientation change issue may use different layout landscape portrait. avoid can use onsaveinstancestate , onrestoreinstancestate

hadoop - Spark: Unknown/unsupported param error when setting conf.yarn.jar -

i have little application runs fine on spark cluster based on yarn when commit spark-submit this: ~/spark-1.4.0-bin-hadoop2.4$ bin/spark-submit --class myclass --master yarn-cluster --queue testing myapp.jar hdfs://nameservice1/user/xxx/readme.md_count however, avoid uploading spark-assembly.jar file each time, set spark.yarn.jar configuration parameter: ~/spark-1.4.0-bin-hadoop2.4$ bin/spark-submit --class myclass --master yarn-cluster --queue testing --conf "spark.yarn.jar=hdfs://nameservice1/user/spark/share/lib/spark-assembly.jar" myapp.jar hdfs://nameservice1/user/xxx/readme.md_count this seems fine @ first: 15/07/08 13:57:17 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 15/07/08 13:57:18 info yarn.client: requesting new application cluster 24 nodemanagers 15/07/08 13:57:18 info yarn.client: verifying our application has not requested more maximum memory capability of cluster (8192 mb per co...

c# - Acessing currently opened solution in a vsix project -

i want access path open solution in visual studio vsix project. how can that? this thread tells if solution open or not gives nothing path of opened solution i use this: public string getinitialfolder(dte dte) { if (!dte.solution.isopen) return null; return system.io.path.getdirectoryname(dte.solution.fullname); } but expect error, cannot return path!

c# - WCF or ASP.net Webservice which uses Sap gateway for microsoft -

i hope question isn't broad answer: planing create webservice (either wcf or asp.net) connect windows desktop software various datasources 1 of them sap database. using sap gateway microsoft best idea approach? include sap datasources in webservice means desktop application request data , webservice decides can data or has save data (mssql database, as400, sap or whatever). you can use sap gateway microsoft if consuming odata service sap gateway system, don't think of in interfacing different databases.

printing - how to connect printer to java application without using printer driver -

i developing application in java swing in have use printer print receipt , printer name epson thermal printer model tm-tm-t88iv (running on parallel port lpt1 ). i want connect printer in java app condition don't want install printer driver, want manually operate printer. have no idea how start. what may want use java communications api. api allows access parallel port, serial ports etc. have @ oracle site: http://www.oracle.com/technetwork/java/index-jsp-141752.html

PHP & MYSQL Order By Decimal Column -

i'm running simple mysql query , trying order data sale value... column in database set decimal(16,2) when data comes isn't sorted in order. here code: $query = " select * , sum(sale_value) sale week_no = $today group user_id order sale_value desc "; $result = mysql_query($query) or die(mysql_error()); // print out result while($row = mysql_fetch_array($result)){ echo "total ". $row['user_id']. " = &pound;". $row['sum(sale_value)']; echo "<br />"; } and here result get: total 14 = £2195.77 total 62 = £865.01 total 52 = £2989.53 total 42 = £2689.47 total 51 = £894.51 total 48 = £962.09 total 39 = £1161.43 total 33 = £1341.49 total 1 = £5989.57 total 8 = £4937.48 total 59 = £1377.70 total 32 = £3063.06 total 41 = £1937.82 total 60 = £2981.01 total 53 = £1050.21 total 46 = £1836.05 total 57 = £310.43 total 19 = £2534.92 total 5 = £1946.01 total 56 = £471.00 total 7 = £865.00 to...

excel - Sorting things to match information on a column -

Image
watch example: i have possible information in first column, second 1 has information of exists phisically. row starting on second column shows information of exists. is there way sort things out this? i've tried sortings things out alphabetically, , didn't work demonstrated. note example. in main sheets things not near 1 yet point stands. i accept either macro or formula answers, thank you. try this. in vba ide have got tool -> reference , select "microsoft activex data ovjects 2.8 library" option explicit private sub sortexisting() dim rspossible new adodb.recordset dim rsexists new adodb.recordset dim ws excel.worksheet dim lrow long dim lfind long set ws = application.activesheet 'add fields recordset storing data. can store sums here. rspossible .fields.append "row", adinteger .fields.append ""possible", adchar, 20 .open end rsexists .fields.append ...

how to re route and dial failed outbound calls through different PRI in asterisk? -

i need solution problem. when dial through 1 pri line x having group g0. dial(dahdi/g0/9xxxxxxxxx,35,rt) , if particular pri down(suppose signal not down not able dial)for reason, how re route , dial number through pri. dial not fail. you can put pri groups using dahdi.conf, set both pri same group number you can use dialstatus variable , gotoif in dialplan hunting dialplan(described in asterisk book)

r - How to embed a html file in email body using RDCOMClient -

Image
i creating html output of dataframe url in 1 of column hyperlinked. want embed in email body instead of attachment, using rdcomclient package. forget rdcomclient. try e.g. send data frame df gmail account: library(mailr) library(xtable) df <- data.frame(links = sprintf('go <a href="%s">here</a>', c("http://stackoverflow.com/questions/31290427/how-to-embed-a-html-file-in-email-body-using-rdcomclient", "http://stackoverflow.com/")), x = 1:2) html <- print(xtable(df), type = "html", include.rownames = false, sanitize.text.function = force) send.mail(from = "...@gmail.com", = "...@gmail.com", subject="subject", body = html, html = true, smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "username", passwd = "password", ssl = true), authenticate = true, send = true) (you may ...

html - Unable to resize the image -

i using below code resize image . want resize image , not trim image ... want whole image smaller size , using below code : <div style="background: url(image_url);"></div> i don't want use <img> tag because cant iterate images because can't put java variable in <img src ="" <img src="<%=img%>"/> --> dosent work gives white_space error try this: <div style="width:200px; height:200px; background: url(image_url) no-repeat; background-size: contain;"></div> using css3 property: background-size: contain; - image streched fit container without cutting off

rest - PUT method error code 405(method not allowed) in restful service URL using VS2013 and IIS Express 8 -

i using put method in restful service throwing error 405 gone through posts in google changed iis config setting not working. before marks duplicate have been dealing issue couple of days, , none of suggested procedures in following posts helped: method 1 yet method you can find more examples, of them referring webdav module (i don't have reputation give more references). if many report solved issue, reason did not solve me, , since question keeps being posted guess not 1 fighting issue. here way managed have delete, put, options verbs working (in both express , iis8.5). simple adding new mapping handler protocolsupportmodule, or in web.config terms: <add name="otherverbshandler" path="*" verb="put,delete,options" modules="protocolsupportmodule" /> do not use handler remaining verbs, since won't able load static files (if nothing else). please note new asp.net , insightful comments solution welcome. edit : ...

sql - Linq to Entities cycling left outer joins -

Image
i have following problem linq entities. diagram: linq entities query (incomplete yet): from in anlaesse join b in beurteilung on a.anlassid equals b.anlassid ab b in ab.defaultifempty() join r in rangliste on a.anlassid equals r.anlassid join p in pony on r.ponyid equals p.ponyid rp p in rp.defaultifempty() a.anlassid == 67 select new { beurteilungid = b.beurteilungid == null ? 0 : b.beurteilungid, ponyid = p.ponyid == null ? 0 : p.ponyid, name = p.name, ponyname1 = r.ponyname1, anlassid = a.anlassid == null ? 0 : a.anlassid } generated sql: select [extent1].[anlassid] [anlassid], case when ([extent2].[beurteilungid] null) 0 else [extent2].[beurteilungid] end [c1], case when ([extent4].[ponyid] null) 0 else [extent4].[ponyid] end [c2], [extent4].[name] [name], [extent3].[ponyname1] [ponyname1] [sspv].[anlaesse] [extent1] left outer join [sspv].[beurteilung] [extent2] on [extent1].[anlassid] = [extent2].[anlass...

ios - Table View Cells showing blanks -

i've got table view cell in .xib. i've got uilabel , uiimageview in .xib. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath object:(pfobject *)object { schoolstableviewcell *cell = (schoolstableviewcell *) [[[nsbundle mainbundle] loadnibnamed:@"schoolstableviewcell" owner:self options:nil] lastobject]; nslog(@"before: %@", cell.namelabel.text); cell.namelabel.text = [nsstring stringwithformat:@"name: %@", [object objectforkey:@"name"]]; nslog(@"after: %@", cell.namelabel.text); pffile *file = [object objectforkey:@"logo"]; [file getdatainbackgroundwithblock:^(nsdata *data, nserror *error) { cell.logoimageview.image = [uiimage imagewithdata:data]; }]; return cell; } as can see, have 2 nslog()s, printing below: 2015-07-08 20:17:26.739 o [1871:108786] before: (null) 2015-07-08 20:17:26.740 o [1871:108786] a...

java - A simple JaxWS Rest that accept JSON Object -

i'm trying develop in java rest webservice (i'm using resteasy) accept generic jsonobject (i'm using json simple 1.1.1). what i've done far: @path("/message") public class testrestservice { @post @path("/{param}") @consumes("application/json") public response printmessage(jsonobject inputjsonobj) { string result = "restful example : " + inputjsonobj; system.out.println(result); return response.status(200).entity(result).build(); } } and client: public static void main(string[] args) { try { url url = new url("http://localhost:8080/myproject/rest/message/"); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setdooutput(true); conn.setrequestmethod("post"); conn.setrequestproperty("content-type", "application/json"); string input = "{\"qty\":100,\"na...

python - Selectable text in PyGTK cell renderer -

Image
i'm looking way implement gtk.cellrenderertext make support selecting cell contents copying. just done html . desirable feature support pango markup language. far have managed render pango code (far ideal actually, though): class cellrendererselectabletext(gtk.cellrenderertext): # ...omitted... def do_render(self, window, widget, background_area, cell_area, expose_area, flags): layout = pango.layout(widget.get_pango_context()) layout.set_markup(self.get_property('text')) # ... widget.get_style().paint_layout(window, gtk.state_normal, false, cell_area, widget, '', x, y, layout) and here i'm stuck. how make rendered text selectable? tried inspiration gtk.label c sources (since supports text selection), got no clear idea of how it. other thing troubles me cell renderer not widget (as pango text inside it) , click-like signals should handled on gtk.treeview level. i conclude gtk.treeview not designed such feature...

set value command in jinja2 works in some cases and not in some -

the following code displays different values of x in different months. set command of jinja2 works flag,x not total. why? {% set flag = 1 %} {% set total = 0 %} {% date in dates %} //dates array {% if flag == 1 %} {{x}} {% set flag= 0 %} // have used 1+1 works {% elif "jul" in date %} {% set x = x*3 %} {% if x % 10!=0 %} {% set x = x - x % 10 %} {% set total = total + x %} {% endif %} {% else %} {{x}} {% set total = total + x %} {% endif %} {% endfor %} {{total}} you have complex computational logic in template : better move logic(or part) data-provider component. for example, in data-provider component can compute x every data , place result data.x . {{dates|sum(attribute='x')}} display total value.

asp.net mvc - Map view Html controls to specific action object MVC -

i have action public actionresult index(int id,int name, someobject object) { //somecode } and someobject class public class someobject { public int id {get; set;} public int name {get; set;} } my view @using (html.beginform()) { @html.textbox("id", "") @html.textbox("name", "") @html.textbox("object_id", "") @html.textbox("object_name", "") <button class="btn-default" type="submit">go</button> } every time submit got object.id , object.name parameters of index action have same values of id , name , can them correctly? note: don't want rename prameters you should update view : @using (html.beginform()) { @html.textbox("id", "") @html.textbox("name", "") @html.textbox("object.id", "") @html.textbox("object.name", "") <button class="btn-default...

android - Sliding drawer at bottom is not opening -

i creating 1 app,in app have set of textview inside scrollview,i set sliding drawer @ bottom open,but issue sliding drawer not opening completely..following snippet code of ui.. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <scrollview android:id="@+id/scrollview" android:layout_width="fill_parent" android:layout_height="wrap_content" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" > <textview android:id="@+id/product_...

javascript - How do I pass hyperlinks into Carrot Search FoamTree? -

i using carrot search foamtree code add hyperlinks html page. here code: <script> // initialize foamtree after whole page loads make sure // element has been laid out , has non-zero dimensions. window.addeventlistener("load", function() { var foamtree = new carrotsearchfoamtree({ // identifier of html element defined above id: "visualization", // data visualize. dataobject: { groups: [ { label: "alkaloid", weight: 1.0, trigger: true}, { label: "flavonoids", weight: 3.0 }, { label: "terpenoids", weight: 2.0 }, { label: "alkaloid", weight: 1.0 }, { label: "flavonoids", weight: 3.0 }, { label: "terpenoids", weight: 2.0 }, { label: "steroids", weight: 4.0 } ]}, }); }); </script> i want produce hyperlinks alkaloids, flavonoids, terpenoids , steroids. how do that? ...

java - NoSuchMethodError: org/apache/log4j/Logger.setLevel(Lorg/apache/log4j/Level;) -

i using these log4j, slf4j , ch.qos.logback dependencies in pom.xml of java project: <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.6.4</version> </dependency> <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-core</artifactid> <version>1.1.2</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>jcl-over-slf4j</artifactid> <version>1.6.4</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>log4j-over-slf4j</artifactid> <version>1.6.4</version> </dependency> <dependenc...

How to fetch text in Textview field through JSON in android? -

i developing android application in have 12 dynamic frame layout in frame layout having text view,video,and play/pause button on .i want fetch text in text view field json. problem when fetch text in text view field using json text appear in 12th frame , rest of 11 frame empty.i don't know how resolve .kindly me . public class mainactivity extends activity { string moviename; private progressdialog pdialog; videoview vv; textview showingat, movie; framelayout frame; arraylist<string> abc; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.navigationbar); abc = new arraylist<>(); new theaterflow().execute(); //main relative layout. final relativelayout rl = (relativelayout)findviewbyid(r.id.mainrelativelayout); //main scrollview. final scrollview sv = (scrollview) findviewbyid(r.id.scrollview); //main linearlayout. final linearlayout ll = (linearlayo...

android - Sending multiple spinner data to a new window on a button click -

actually working on multiple spinner window , wanted know how send selected spinner elements new window on clicking ok button on existing window if understand correctly want way send data between activities. well, easy , right way so, putting intent. so intent intent = new intent(currentactivity.this, nextactivity.class); intent.putextra("spinnerdata", data); startactivity(intent); that should do

android - java.lang.NoSuchMethodError: Landroid/os/PowerManager$HtcCpuCtrl$1;.<init> -

had link [ http://docs.oracle.com/javase/7/docs/api/java/lang/nosuchmethoderror.html][1] , not know error occur. knows. note: error happend on htc609d phone, , not crash always. java.lang.nosuchmethoderror: landroid/os/powermanager$htccpuctrl$1;.<init> @ android.os.powermanager$htccpuctrl.<init>(powermanager.java:972) @ android.os.powermanager.newhtccpuctrl(powermanager.java:1280) @ android.widget.abslistview.onattachedtowindow(abslistview.java:2859) @ android.view.view.dispatchattachedtowindow(view.java:11895) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2428) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2435) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2435) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2435) @ android.view.viewgroup.addviewinner(viewgroup.java:3443) @ android.view.viewgroup.addview(viewgroup.java:3275) @ android.view.viewgroup.addview(viewgroup.java:3220) @ android...

Flask-Admin+SQLAlchemy image upload works in MySQL production env but not in SQLite testcase: InterfaceError -

i have created web application using flask, flask-admin , flask-sqlalchemy administrator can upload images. image uploading functionality imitated largely this flask-admin example . production website, use mysql , uploading works fine. however, in test suite use memory-mapped sqlite database , attempt upload image through same form fails interfaceerror . see this gist full details , reduced test case. it seems might have type mapping, mysql backend of sqlalchemy appears understand filename of uploaded image must inserted in sql statement while sqlite backend not. however, flask-admin example linked above works absolutely fine , based on sqlite, too. who can tell me wrong, , needs done make test pass? edit add: turned out issue known flask-admin developers. see ticket on github . yes, you're right. reason of problem. problem difference in sqlite , mysql backends. as can see in stack trace, it's trying bind parameter of type filestorage , fails. interfac...

java - Unable to start OSGI framework on eclipse or after converting to jar -

iam developing osgi equinox launcher should start osgi framework , equinox console.i have added 5 jars in folder called plugin part of classpath/buildpath still iam unable execute. below command executes on linux console , opens osgi> prompt on linux console. java-dosgi.bundles=org.eclipse.equinox.console_1.1.0.v20140131-1639.jar.@start,org.apache.felix.gogo.command_0.10.0.v201209301215.jar@start,org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar@start,org.apache.felix.gogo.shell_0.10.0.v201212101605.jar@start -jar org.eclipse.osgi_3.10.0.v20140606-1445.jar -console but above fails in code below public static void main(string[] args) { string command ="java-dosgi.bundles=plugin/org.eclipse.equinox.console_1.1.0.v20140131-1639.jar@start,plugin/org.apache.felix.gogo.command_0.10.0.v201209301215.jar@start,plugin/org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar@start,plugin/org.apache.felix.gogo.shell_0.10.0.v201212101605.jar@start -jar plugin/org.eclipse.o...

angularjs - MeanJS: Generate the Sub-CRUD-Module with the generator? -

i have crud-entity strong relationship entity, comments posted , viewed above article. i want use document db structure. every comment should saved in article. dont want have comments collection in every comment saved , referenced articles collection, relational db structure suggest. my question is: best practice create document style sub crud module in mean.js? should i... generate it, disable creation in collection , link angular-controllers/views across modules? generate it, disable creation in collection , move files father crud module? refrain generating it, create needed files direct in father module? create needed files direct in father module. i did similar avoid referencing other documents, can edit module schema embed schema schema, check link: http://www.jonahnisenson.com/schema-within-a-schema-use-embedded-documents-in-mongoosemongo/

ios - Sharing Facebook open graph action succeeds, but post isn't visible -

i'm migrating legacy app facebook ios sdk 2.x 3.x, , i'm having trouble getting open graph object share successfully. here's code have share object: nsmutabledictionary *properties = [@{ @"og:type": @"my-app:my-object", @"og:title": @"title", @"og:description": @"text", } mutablecopy]; if(photourl){ fbsdksharephoto *photo = [fbsdksharephoto photowithimageurl:[nsurl urlwithstring:photourl] usergenerated:no]; properties[@"og:image"] = @[photo]; } fbsdkshareopengraphobject* graphobject = [fbsdkshareopengraphobject objectwithproperties:properties]; fbsdkshareopengraphaction *action = [[fbsdkshareopengraphaction alloc] init]; action.actiontype = @"my-app:my-action"; [action setobject:graphobject forkey:@"my-object"]; fbsdkshareop...

Unusual javascript behavior -

i have encountered weird behavior in javascript. consider code: var foo; function bar(){ function foo(){}; foo = 10; return; } foo = 1; bar(); console.log(foo); this output 1. if delete foo function declaration in third line, output 10. why isn't output 10 when function declaration there? , reason if change function definition this: foo = function(){}; it output 10 again? know hoisting of function declarations, doesn't seem answer this. that's not weird - have variable called foo , you're setting 1 normally. inside bar function, foo function if present, shadows variable if not present, foo references original variable. as such, if define foo function, foo=10 take effect on that, otherwise take effect on original foo. as second part of question (why change if use var foo=... ), that's because in case duplicate variable declaration merged one, end same if didn't write var .

c# - SharpGL: Setting the version to 4.0 or a replacement for GLEW -

currently i'm stuck making c#-wpf-opengl application. followed http://www.codeproject.com/articles/265903/using-opengl-in-a-wpf-application tutorial , able run sample project. however, first call function that's not part of opengl 1.1.0 fails, i.e code looks this private void openglcontrol_openglinitialized(object sender, opengleventargs args) { opengl gl = args.opengl; gluint glerror; while ( (glerror = gl.geterror()) != opengl.gl_no_error ) { console.writeline( gl.geterrordescription(glerror) ); } console.writeline( gl.getstring(opengl.version) ); //prints out 1.1.0 gluint hvertexshader; hvertexshader = gl.createshader(opengl.gl_vertex_shader);//compiles, raises exception, gl.createprogramm() or other functions } somehow link https://github.com/dwmkerr/sharpgl/wiki/specifying-opengl-version can't me set version 4.2. how can achieve that? solved! missing renderingcontext="fbo" in mainwindow.xaml, so <sharpgl:openglcontrol ...

influxdb - Name series with dash -

i have series name contain dash (exemple: foo-bar), can't apply queries series. got message error : error: syntax error, unexpected '-', expecting $end select * foo-bar ^ full syntax queries here on influxdb website. identifiers containing characters other a-z,0-9,_ must quoted. https://influxdb.com/docs/v0.9/query_language/query_syntax.html

.net - How to optimize my if else code c# -

i have code below: tryupdatemodel(model); if (modelstate.isvalid && model.fullnameischecked == true && model.lookingfor == null) { model.contactlist = contactrepository.getall(filter: x => x.userid == user.id); model.contactlist.sort((x, y) => string.compare(x.fullname, y.fullname)); } else if (modelstate.isvalid && model.fullnameischecked == false && model.lookingfor == null) { model.contactlist = contactrepository.getall(filter: x => x.userid == user.id); model.contactlist.sort((x, y) => string.compare(x.email, y.email)); } else if (modelstate.isvalid && model.lookingfor != null && model.fullnameischecked == true) { model.contactlist = contactrepository.getall(filter: x => x.userid == user.id); model.contactlist = contactreposi...

swing - Java Open GUI and wait until its closed -

i'm trying open gui , wait until jframe closed. heard jdialog don't know how use actual code: gui gui = new gui(); gui.show(); // creates jbuttons, jlabels, , show jframe. now wait until jframe closed, don't know how continue. can me please? you can this: inherit jdialog instead of jframe . call setmodalitytype(modalitytype.application_modal) make dialog modal. if use jframe(layoutmanager) constructor, have call setlayout() set layoutmanager instead. when done dialog, call setvisible(false) or dispose continue program. ps: next time should post working code exposes problem.

web component - To what viewport do media queries in Shadow DOM elements apply? -

the html5 rocks tutorial on styling shadow dom doesn't discuss media queries. since shadow boundary supposed provide style encapsulation free, neat if @media queries applied size of host element, rather viewport of browser. this solve problem of media queries being hack when in reality need @element queries, of july 2015 exist abandoned repo on github . alas, no. @media queries inside shadow dom @ viewport of browser, not @ dimensions of host element. var root = document.queryselector('div').createshadowroot(); root.innerhtml = '<style>@media (min-width: 600px) { h3 { color: red; }}</style>' + '<h3>if text not red, live far in future</h3>'; <div style="border: 1px solid black; width: 100px"><h3>light dom</h3></div> this because of circularity issues might ensue if shadow dom element sized in way incompatible host.

asp.net - Is it possible to select a custom handler by request verb? -

i write custom handler handle requests options verb. public class optionsrequesthandler : ihttphandler { public void processrequest(httpcontext context) { string origin = context.request.headers.get("origin"); context.response.addheader("access-control-allow-origin", origin); context.response.addheader("access-control-allow-methods", "*"); context.response.addheader("access-control-allow-headers", "accept, authorization, content-type"); } public bool isreusable { { return false; } } } and have registered handler in web.config. <system.webserver> <modules> ...... </modules> <handlers> ...... <add name="optionshandler" path="*" verb="options" type="reams.infrastructure.requesthandlers.optionsrequesthandler"/> <add name="extensionlessurlhandler-integrated-4.0" path=...

html - How do I position a div below an image with changing height? -

in new site have image set width 100% , text underneath that. how change position of text based on height of image? html: <div class = "pic"> <img src="#"/> </div> <div class ="text"> <h3>some important message</h3> </div> css: .pic{ position:absolute; left:0; width:100%; } .pic img{ position:absolute; width:100%; } .text{ position:relative; margin-top:10px; } as requested, here fiddle https://jsfiddle.net/slx3n2vz/ please try this: remove css , add only .pic{ width:100%; } .pic img{ width:100%; } .text{ margin-top:10px; } demo the way positioning html element wrong. please correct it.

AWS Cloudsearch Ruby SDK errors on providing expressions: Found invalid value where JavaScript Object was expected -

i trying use aws cloudsearch rails console. i trying provide expressions aws cloudsearch searchrequest query. gives me error : "found invalid value javascript object expected" i able provide simple query string, filter query , query parser. terminal : aws.config.update({region: 'us-west-2',credentials: aws::credentials.new(‘key_id', ’secret_key'), }) csd = aws::cloudsearchdomain::client.new(region: 'us-east-1', endpoint: 'http://search-endpoint.us-east-1.cloudsearch.amazonaws.com/') 1.9.3-p551 :340 > 1.9.3-p551 :341 > fq => "location:['40.628611,-100.694152','25.621966,-66.686706']" 1.9.3-p551 :342 > csd => #<aws::cloudsearchdomain::client> 1.9.3-p551 :343 > csd.search(query:'user*', query_parser:'simple', filter_query: fq) => #<struct aws::cloudsearchdomain::types::searchresponse status=#<struct aws::cloudsearchdomain::types::searchstatus timems=1...