Posts

Showing posts from September, 2015

selenium webdriver - I want to execute specific test cases say for Ex: TC5 and TC10 using TestNG? -

when have 10 automation test cases , want execute specific test case tc5 , tc10. how acheive using testng? from running tests in testng testng can invoked in different ways: command line ant eclipse intellij's idea with 4 links should able appropriate documentation whichever way want run. each 1 documents how run select methods, classes, packages, , groups. you can define testng.xml file includes/excludes methods/classes/packages/groups want run. e.g.: <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="partial-tc-suite"> <test name="tc5+tc10"> <classes> <class name="com.example.test.tc5"/> <class name="com.example.test.tc10"/> </classes> </test> </suite>

Javascript/Java - Webservice returning doubles for date.valueOf() -

i have javascript webservice returns array of timestamps using date.valueof(). but reason when android application gets results doubles! why happening? have confirmed array in webservice loaded non double values! valueof() returns primitive value of date object, double you're seeing date expressed in milliseconds since midnight 01 january, 1970 utc. known epoch time. if want date in other format, should @ documentation getfullyear, getmonth, , getdate, use construct string date. alternatively, java has calendar class has functions convert epoch time regular dates.

google chrome - Are GCM subscription IDs and instance IDs the same thing? (subscribe to topics via web) -

i'm trying set gcm html5 push notifications through chrome. want these subscriptions use topics, don't have maintain list of subscribed ids myself. however, of topic documentation can find refers subscribing through ios , android apis, not through web. i found documentation on relationship mapping makes seem can control topic subscriptions sending requests server, requires instance id. documentation i've been able find chrome web notifications talks subscription id. are same? i.e., send subscription id server, forward onto gcm server api? or instance id , subscription id 2 different things? don't same in examples provided (the instance id start xxxxxx:yyyyy) i'm concerned won't work. to answer own question: in fact 1 , same. unfortunately, seems topics not work chrome push notifications. api displays topic message being sent, browser never receives it.

python - Why does Pandas give me only one SettingWithCopyWarning? -

i have following code: import pandas pd import numpy np mydf = pd.dataframe({'uid':[1,2,3], 'price':[10,20,30], 'shipped':[2,4,6]}) grouped = mydf.groupby('uid').aggregate(np.sum) # call 1 mydf['price'].loc[:] = np.round(grouped['price'], 2) # call 2 mydf['shipped'].loc[:] = grouped['shipped'] the line have preceded call 1 executes no errors or warnings. line have preceded call 2 results in settingwithcopywarning error. why 1 result in error , not other? can in second call in order rid of error? my code executes fine, i'm tired on seeing 1 lone error every time run tests. no settingwithcopywarning error mydf['shipped'].values[:] = grouped['shipped']

rest - Defining an API with swagger: GET call that uses JSON in parameters -

i trying create proper, rest api, , document swagger (2.0). so, have api call query, ie, makes no changes , doesn't create (idempotent , safe). requires passing in complex json parameter (list of items, 2 or 3 sets of addresses, etc). i'm doing parameter thats url encoded json. seems proper way it. i see api's post reason, that's incorrect use of post verb. i'm seeing lots of swagger api's this... i can't figure out if there's way proper rest api swagger, using json parameter. can define parameter string, of course, , pass encoded json it, swagger tooling doesn't understand there's schema/definition it. is swagger not able document kind of call? i'm working on defining form parameters url-encoded json objects , facing same situation yours. thoroughly going through swagger specs tell not supported yet, required rest apis. also, can't define schema such object.

javascript - Method under test appearing in unit test other than in the action -

i wondering if give me pointers on designing unit tests, function being tested appears in test other in unit's action. i'm writing server side javascript node , using rsvp asynchronous calls restful backend. i structure unit tests follows. //setup //action //assertion //cleanup right now, i'm building function asynchronously deletes enteries in database unit test looks this. "deletingfunction_1entry_returns1entrydeleted": function() { return new rsvp.promise(function( resolve, reject ) { //setup var databaseentry = { "info": "info" }; setup( databaseentry ).then(function( xpostedentries ) { //if setup promise resolves then... //action xdelete( xpostedentries ).then(function( xdeletedenteries ) { //assertion if ( xpostedentries === xdeletedentries ) { //if posted enteries matched deleted enteries then... resolve(); ...

Removing repeated string in javascript -

i have problem 1 of string has repeated url inside , want remove it. what's best way in javascript? following example of string referring to. var str = " http://www.example.comhttp://www.example.com " one solution reassign str half of itself. str = str.substring(str.length/2) (this assumes string follow same format example gave.)

c++11 - C++ type erasure, capture multiple methods of a single class with std::function -

consider following code, in std::function used 3 times capture methods of 1 class: struct some_expensive_to_copy_class { void foo1(int) const { std::cout<<"foo1"<<std::endl; } void foo2(int) const { std::cout<<"foo2"<<std::endl; } void foo3(int) const { std::cout<<"foo3"<<std::endl; } }; struct my_class { template<typename c> auto getfunctions(c const& c) { f1 = [c](int i) { return c.foo1(i);}; f2 = [c](int i) { return c.foo2(i);}; f3 = [c](int i) { return c.foo3(i);}; } std::function<void(int)> f1; std::function<void(int)> f2; std::function<void(int)> f3; }; this, however, perform 3 copies of class some_expensive_to_copy_class , inefficient 1 have guessed name. is there workaround such 1 copy made? to emphasize it, i'm interested here in approach using std::function , not void -pointers , not corresponding i...

javascript - Converting color through library doesn't work correctly -

i'm trying make simple conversion color.js this library . able implement it, output shows wrong values. here's did: var mycolor = new colors(); var hslcolor = mycolor.convertcolor({ h: 100, s: 100, v: 100 }, 'hsv2hsl'); output object {h: 100, s: -1.0204081632653061, l: -4900} it's doable see in convertiontest function @ line 517 did same thing i. doing wrong, , how can fix it? jsfiddle var mycolor = new colors(); var hslcolor = mycolor.convertcolor({ h: 100, s: 100, v: 100 }, 'hsv2hsl'); console.log(hslcolor); <script src="https://rawgit.com/pitpik/colorpicker/master/colors.js"></script> looks names should in caps: var mycolor = new colors(); var hslcolor = mycolor.convertcolor({ h: 100, s: 100, v: 100 }, 'hsv2hsl'); console.log(hslcolor); <script src="https://rawgit.com/pitpik/colorpicker/master/colors.js"></script> ...

Publish an Android App on Google Play only for smartphone -

for day i've looked way pubblish android app on google play store smartphone. i found way http://developer.android.com/guide/practices/screens-distribution.html#filteringhansetapps : <compatible-screens> <!-- small size screens --> <screen android:screensize="small" android:screendensity="ldpi" /> <screen android:screensize="small" android:screendensity="mdpi" /> <screen android:screensize="small" android:screendensity="hdpi" /> <screen android:screensize="small" android:screendensity="xhdpi" /> <screen android:screensize="small" android:screendensity="480" /> <screen android:screensize="small" android:screendensity="560" /> <!-- normal size screens --> <screen android:screensize="normal" android:screendensity="ldp...

magento - magmi configurable items are not grouped with their simple ones and images aren't imported -

assistance appreciated. did import magmi in magento , items imported . configurable items not grouped simple ones! this import csv: download magmi.csv screen capture of import settings: http://awesomecowboy.com/capture.jpg i fixed problem editing attribute in magento simple in list of product types size attribute applied to.

java - Controller doesn't call internal function -

i'm trying make java crud mvc application. uses sqlite database. 1 of functions doesn't want work. in function want prepare pdf document contain strings. work when try run function separated class, when put mvc app doesn't work. the console doesn't show errors, think function doesn't start. suppose parameter problem? here controller.java : public void generuj(){ akcja = new actionlistener() { public void actionperformed(actionevent event) { string[] args = null; pdf.main(args); interfejs.getguzikgeneruj().addactionlistener(akcja); } }; } here functions.java: public static void generuj() throws documentexception{ document dokument = new document(); try { pdfwriter.getinstance(dokument, new fileoutputstream("arkusz inwentaryzacyjny.pdf")); dokument.open(); paragraph paragraf = new paragraph(); paragraf.add("arkusz inwentary...

css - Autoprefixer error on Sublime Text 2 -

i'm trying install autoprefixer sublime text 2 , i'm getting following error: autoprefixer error: /users/labedzde/library/application support/sublime text 2/packages/autoprefixer/node_modules/get-stdin/index.js:7 return new promise(function (resolve) { ^ referenceerror: promise not defined @ module.exports (/users/labedzde/library/application support/sublime text 2/packages/autoprefixer/node_modules/get-stdin/index.js:7:13) @ object. (/users/labedzde/library/application support/sublime text 2/packages/autoprefixer/autoprefixer.js:7:1) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:906:3 i have node.js installed , it's version 0.10.32. what error mean , how can install ...

html5 - How to make double navbar responsive -

Image
i redesigning website has 2 row responsive navbar , stuck. @media (min-width: 767px) { .nav.navbar-nav { float: right; } } <div class="navbar navbar-default navbar-fixed-top"> <div class="collapse navbar-collapse "> <ul class="nav navbar-nav"> <li class="community"><a href="#"><strong>community</strong></a></li> <li class="global"><a href="#"><strong>global</strong></a></li> </ul> </div> <div class="navbar-header"> <div id="button" type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar...

matlab - mcc producing an unresponsive executable -

i trying compile matlab function using mcc function. function writes line of text file. function hello() ofid = fopen('hello.txt','w'); fprintf(ofid, 'hello there, matlab.\n'); fclose(ofid); end it runs expected when called matlab console. however, when compile file executable using mcc /opt/matlab/matlab2008a/bin/mcc -m hello.m and run as ./hello it seems run forever , produces no hello.txt file. both executable matlab function files in matlab working directory. i unable see can possibly wrong in use of mcc . please help. typically, need setup matlab runtime environment when executing mcc compiled applications. you'll more mileage first time using deploytool (from command line) compile hello.m program here. matlab's application builder produce run_hello.sh file can peruse through see how setup libraries. then, execute program call this: ./run_hello.sh /applications/matlab/matlab_runtime/v90/ note: have ...

django - Add context to head of ListAPIView -

i add {'user': self.request.user} header of listapiview. for example, json response like: [ 'user': testing_user, { id: 67, slug: "slugy", }, ] is possible this view? class bookarchiveapiview(generics.listapiview): cache_timeout = 60 * 7 serializer_class = bookserializer queryset = book.objects.all() i know late needed same thing , found on documentation easily. you don't need pass "request.user" view because drf gives you. here example: class show_activities(generics.listapiview): serializer_class = activityserializer def get_queryset(self): username = self.request.user.username return activity.objects.filter(owner=username) it's easy find on documentation i'm answering ones couldn't see it.

java - android spell checker - can it be improved? -

i have been looking @ android spellchecker example in sdk samples. hellospellchecker working seems utterly useless. most strings return no suggestions , others unhelpful. e.g. "tihs" returns 1 suggestion "this" "helo" returns 3 suggestions "he'll" "help "believe" "tabble" returns no suggestions the samplespellchecker example appears absolutely nothing. is there way make checker better? how else can 1 provide spell checker (i want list of words returned when word entered)? i have seen spellchecker framework ment provide same used when sending text on android phone not working well. http://developer.android.com/guide/topics/text/spell-checker-framework.html describes framework don't find helpful , quite hard understand have been @ day, appreciated

facebook - Permissions for application -

i set user & friend permissions on application, user email on website. info when click preview login dialog : this app receive: your basic info email address (xyz@xyz.com) birthday relationship details photos when tried log in on website, application needs information: this app receive: your basic info why? why doesn't main application have same permissions preview? regards edit: i'm using auth tutorial: http://www.asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc - , code has not changed in project. honestly, don't want change authorization methods, because want provide twitter login, , mechanism perfect me. i want add facebook "scope=email,publish_stream". i discovered, when put query manually when website redirect me facebook application ( &scope=email,publish_stream ), works perfect. there solution on back-code? the app detail page in app center displays permissions required new users. can consi...

Mysql Group by counting issue -

database structure table 'applicants' id org_id team_id 1 1 1 table 'teams' id name 1 test table 'teams_members' id team_id user_id 1 1 1 2 1 2 table 'users_playeraccounts' id user_id summoner_id rank_solo 1 1 1 5 2 1 2 8 3 2 3 7 select sum(rank_solo) rank_sum, max(rank_solo) highest_rank, count(tt.id) members, t.name, o.team_id applicants o join teams t on o.team_id = t.id join teams_members tt on t.id = tt.team_id join users_playeraccounts p on tt.user_id = p.user_id org_id = :org group team_id this offcourse gives me result like r...

javascript - How can I access the tag-name of a jsf composite whitin the composite? -

i have composite (as in xmlns:composite="http://java.sun.com/jsf/composite"). call via <comps:cimgx imgid="ima" flav="r" /> (for example) on page. there way reference html-objects generated composite, client-side via javascript? something like window.document.getelementsby_magic_jsf_tagtype("comps.cimagx"); edit: or within composite like #{cc.jsf_tag_type_name} ?? edit2: background why i'm asking this, see is possible add javascript function h:form in jsf2? js knows nothing server side code responsible producing html output on html document object model based. information has end in html in way. abstraction, make use of css classes. <cc:implementation> <div id="#{cc.clientid}" class="comp-cimgx"> ... </div> </cc:implementation> var cimgxs = document.getelementsbyclassname("comp-cimgx"); (note: getelementsbyclassname() not support...

recovery - My apps script code has seemingly disappeared overnight. How can I recover it? -

i not sure title this, title accurate. apps script code spent last few days working on has , vanished project. i have web app re-wrote javascript on last new days, working fine , deployed new version of web app. however, upon opening apps script file today changes no longer there. published web app still works though, though code no longer exists in project. i can recover code published web app copying elements page, had made lot of changes app afterwards. key points: changes made saved, deployed new version of of new code. none of code last few days exists in files in project, it's if never worked on @ all. how did happen? how can recover "lost" code google apps script project? i figured out. going delete question, thought better post answer else runs this. the cause: it looks had left tab open on work pc apps script project open. when changes made, don't update on views google docs/sheets. according revision history, looks overwrote pr...

node.js - MongoDB: Waiting for available socket hanging -

so using mongoose's findoneandupdate update key value in document. needing increment number one. if it's not in there should create new document. it's in post route in node. i have information going post route on button click. app requires users click button multiple times in succession , i'm getting waiting available sockets... @ bottom of browser , hangs. i doing on localhost. @ end of request once "unhangs" following error in console: post http://localhost:3000/api/songsqueued net::err_empty_response this post route i'm working with: router.post('/api/songsqueued', function(req, res){ song.findoneandupdate({songid: req.body.songid}, { $inc:{queuetimes: 1} }, function(err, song){ if (err) { return console.log("error: " + err) } if(song){ song.queuetimes += 1; song.save(function(err){ if(err){ console.log(err) ...

database - Microsoft Access - Progress bar when running a single query -

i've seen number threads / forums examples of progress bars in access databases unfortunately hasn't resolved issue. i know access has small status bar shows progress of running query not adequate needs. is possible show on popup form progress bar of current (single) query running? displaying percentage of how of query has been processed? or perhaps possible display status bar in popup form? many max no, can't either. for single query, there is internal, automatic progress bar. custom, manual progress bars possible if have multiple actions (like loop).

C++: Boost interprocess memory mapped file error -

i'm trying create memory mapped file using this answer, i'm getting compile errors. code: namespace bi = boost::interprocess; std::string vecfile = "vector.dat"; bi::managed_mapped_file file_vec(bi::open_or_create,vecfile.c_str(), sizeof(struct rectangle) * data_size); typedef bi::allocator<struct rectangle, bi::managed_mapped_file::segment_manager> rect_alloc; typedef std::vector<struct rectangle, rect_alloc> myvec; myvec * vecptr = file_vec.find_or_construct<myvec>("myvector")(file_vec.get_segment_manager()); vecptr->push_back(random_rectangle); the struct this: struct rectangle{ rectangle(float *minarr, float *maxarr, int arr, int exp, int id){ this->arrival = arr; this->expiry = exp; this->id = id; for(int i=0; < 2; i++){ min[i] = minarr[i]; max[i] = maxarr[i]; } int arrival, expiry, id; float min[2]; float max[2]; } the error is: compiler not deduce template argu...

redirect - Rails 4, Devise - after_sign_in -

i trying make app in rails 4. i trying follow along tutorial: http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/ i have moved after_sign_in_path omniauth callbacks controller application controller, can extend it. my current attempt in application controller is: def after_sign_in_path_for(resource) if !resource.email_verified? finish_signup_path(resource) elsif params[:redirect_to].present? store_location_for(resource, params[:redirect_to]) elsif request.referer == new_session_url profile_path(resource.profile) # or whatever route destination want else store_location_for(resource) || request.referer || root_path end end when try this, error: argumenterror in users::omniauthcallbackscontroller#linkedin wrong number of arguments (0 1+) it highlights line of above method: elsif request.referer == new_session_url i don't know error message means....

java - Android IDE issue arises when I try to move layouts within tabHost -

so i'm working on app, trying work on multiple layouts within tabhost. when try reorder layouts within tabhost creates ide error, , fails render. experienced java, first attempt @ working android studio. here's error execute command activetool: com.intellij.designer.designsurface.tools.selectiontool@3e7bfc0b sdk: android 6.0 - api 23 java.lang.arrayindexoutofboundsexception: 0 @ com.intellij.android.designer.model.radviewcomponent.updatetag(radviewcomponent.java:105) @ com.intellij.android.designer.model.radviewcomponent.updatetag(radviewcomponent.java:105) @ com.intellij.android.designer.model.radcomponentoperations$1.run(radcomponentoperations.java:96) @ com.intellij.openapi.application.impl.applicationimpl.runwriteaction(applicationimpl.java:931) @ com.intellij.android.designer.model.radcomponentoperations.movecomponent(radcomponentoperations.java:80) @ com.intellij.android.designer.designsurface.abstracteditoperation.execute(abstracteditoperation.java:49) @ com.inte...

html - How to apply this sidebar to all pages using CSS? -

i have 4 different html web pages. html code below menubar want apply 4 pages. there way can using css instead of copying/pasting menubar html code on 4 of html web pages? 4 pages home, news, contact, about. whenever clicks on menubar item, redirect them 1 of 4 pages. , on 4 of pages, want menubar displayed. want create css file can link 4 pages , menubar displayed (code below). in advance! is there way can create css file @ least takes care of styling? , manually add menubar buttons each html page? <!doctype html> <html> <head> <style> body { margin: 0; } ul { list-style-type: none; margin: 0; padding: 0; width: 25%; background-color: #f1f1f1; position: fixed; height: 100%; overflow: auto; } li { display: block; color: #000; padding: 8px 0 8px 16px; text-decoration: none; } li a.active { background-color: #4caf50; color: white; } li a:hover:not(.active) { background-color: #555; col...

java - how to remove space between jtextfield, jbutton and raisedbevel border -

i wants remove blank space or border space between jbutton , jtextfield added inside raisedbevel border tried code still gap between them import java.awt.*; import javax.swing.*; import javax.swing.border.border; public class main { public static void main(string args[]) { jframe f = new jframe("jpasswordfield "); f.setdefaultcloseoperation(jframe.exit_on_close); jpanel p=new jpanel(),pp=new jpanel(); jbutton b=new jbutton("o"); b.setborder(null); b.setborderpainted(false); b.setmargin(new insets(0,0,0,0)); border emptyborder = borderfactory.createemptyborder(); b.setborder(emptyborder); border raisedbevel=borderfactory.createraisedbevelborder(); pp.setborder(raisedbevel); jtextfield t=new jtextfield(20); t .setborder(javax.swing.borderfactory.createemptyborder()); t.setpreferredsize(new dimension(100, 25)); b.setpreferredsize(new dimension(25, 25)); pp.setbackground(color.black); pp.add(t); ...

Connect impala with odbc and php pdo, string fields are empty -

when use odbc only, run successfully $dsn = "dsn=dingdongimpala;host=172.168.1.100;port=21050;database=mmdb;"; $user = ''; $password = ''; $conn = odbc_connect($dsn, $user, $password); $result = odbc_exec($conn, "select succount,failedcount,appid t_mm_acc_date limit 1"); while($row = odbc_fetch_array($result)) { print_r($row); } the result is: array ( [succount] => 0 //int [failedcount] => 1 //int [appid] => 202361 //string ) but when use pdo access odbc, string type fields empty $dsn = "odbc:dsn=dingdongimpala;host=172.168.1.100;port=21050;database=mmdb;"; $user = ''; $password = ''; $cnx = new pdo($dsn, $user, $password); $result = $cnx->query("select succount,failedcount,appid t_mm_acc_date limit 1"); print_r($result->fetchobject()); the result is: stdclass object ( [succount] => 100 //int [failedcount] => 0 //int ...

.net - PictureBox image appears differently on different computers -

Image
what see: what customer sees: the images different sizes due different resolutions @ time screenshots taken. issue see logo cutoff text , button. i have tried many different resolutions on computer , image looks correct. has tried many different resolutions on computer , image cutoff. designer code: me.picturebox1.image = ctype(resources.getobject("picturebox1.image"), system.drawing.image) me.picturebox1.location = new system.drawing.point(12, 12) me.picturebox1.name = "picturebox1" me.picturebox1.size = new system.drawing.size(96, 56) me.picturebox1.sizemode = system.windows.forms.pictureboxsizemode.autosize me.picturebox1.tabindex = 0 me.picturebox1.tabstop = false it looks os text scaling set 125% or 150% on computer. affects layout of forms.

Grok Parse Failure on Custom Log Format and regex in logstash -

i have custom log format ,i new trying figure out how works . not getting parsed in logstash .can identify issue. logformat follows {u'key_id': u'1sdfasdfvaa/sd456dfdffas/zasder==', u'type': u'audio'}, {u'key_id': u'iu-dsfaz+ka/q1sdfq==', u'type': u'hd'}], u'model': u'level1', u'license_metadata': {u'license_type': u'streaming set', u'request_type': u'new', u'content_id': u'aaaa='}, u'message_type': u'license', u'cert_serial_number': u'aaaasssseerrttyuuiioooasa='} i need parsed in logstash , store in elasticsearch the problem none of existing grok pattern taking care of , unaware of regex custom config alain's comment may useful you, if log is, in fact, coming in json may want @ json filter automajically parse json message elastic friendly format or using json codec in input. if want stick gr...

javascript - Kendo UI grid - How can I show a processing / loading percent indicator -

is there way show processing percentage or progress bar show loading progress user in kendo grid. kindly share. -philip- take @ databinding , databound event of kendo.ui.grid. pseudo code $("#grid").kendogrid({ databinding: function(e) { //show processing modal console.log("databinding"); }, databound: function(e) { //hide processing modal console.log("databound"); } });

python - how to add new item in pandas series without erasing other items -

i have following pandas series. new_orders_list out[853]: cluster 1 [525, 526, 533] cluster 2 [527, 528, 532] cluster 3 [519, 534, 535] cluster 4 [530] cluster 5 [529, 531] cluster 6 [520, 521, 524] and,i have 2 more series after slicing on dataframe. condition out[854]: 5 525 name: order_id, dtype: object condition2 out[855]: clusters cluster 6 1 name: quant_bought, dtype: int64 now want add value of condition series 525 new_orders_list @ cluster 6 (index condition2 series) location. , erasing off 525 cluster 1 location. so, should this cluster 1 [526, 533] cluster 2 [527, 528, 532] cluster 3 [519, 534, 535] cluster 4 [530] cluster 5 [529, 531] cluster 6 [520, 521, 524, 525] i doing following in python. appends stored values. new_orders_list.append(pd.series(condition.values ,index = condition2.index)) cluster 1 [525, 526, 533] cluster 2 [527, 528, 532] cluster 3 [519, 534, 5...

data binding - Android dataBinding - how to use bool resource to trigger visibility of layout -

i have bool.xml file in android looks this: <?xml version="1.0" encoding="utf-8"?> <resources> <bool name="showads">true</bool> </resources> now have layout.xml file uses databinding. want show or hide visilibity of adview based on boolean showads defined above. far have this: <com.google.android.gms.ads.adview android:id="@+id/adview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="@{@bool/showads ? view.visible:view:gone}" ads:adsize="banner" ads:adunitid="ca-app-pub-1234567/34343"> but not compile. how can boolean decide if ad should show or not ?the syntax wrong. correct syntax of condition view.visible:view:gone android:visibility="@{@bool/showads ? view.visible:view.gone}" and need import view in data section: <data> ...

A Simple input/output query of C++ -

i have take input: 3 sam 99912222 tom 11122222 harry 12299933 so, wrote down following code: string s; int num,n; cin>>n; while(n--){ getline(cin,s); cin >> num; cout << "s=" << s << " num=" << num << endl; } so, expected output should be: s=sam num=99912222 s=tom num=11122222 s=harry num=12299933 but output is: s= num=0 s= num=0 s= num=0 where did wrong? one problem cin>>n; statement count leaves newline in input buffer. when call getline see newline , think entered empty line. then gets worse when try read number, next text not number, it's name, , trying read number set failbit . a standard solution ignore characters until newline, skip rest of line including newline character. like std::cin >> n; std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); you of course need after other inp...

Is it mandatory to Write static void Main(string[] args) in C#? -

because debug simple program took runtime inputs 2 numbers , showed sum of 2 number. did without writing string[] args. necessary write these in every program? no, it's not mandatory. the documentation on main() , command-line arguments (c# programming guide) says: the main method can declared or without string[] parameter contains command-line arguments. so, valid entry point: static void main() { console.writeline("hello world"); }

windows - downloading parts of a html page on an event -

i developing universal windows app. need download webpage , extract images it. i got html code , extracted links images , downloaded them. thing is, site has infinite scrolling (like facebook). when scroll down bottom loads more images. not able incorporate app. beginner , have little knowledge of web development or windows app development. first app. stuck , have no idea how proceed. don't want use webview displays ads site , other unnecessary contents. want links images. please me go past situation. need way download new html content site loads when user gets bottom or other way image links. thanks in advance. you may or may not me implement because of reason stated. need determine how site loads information. first download fiddler , in turn enable https connect logging can see encrypted traffic going through fiddler. btw web view has events can hook see loading urls, etc , can hidden. so again need first understand how site want on works , emulate that, assum...

documentation - Cheatsheet for Markdown and Restructure syntax comparision? -

is there cheatsheet compares usage of markdown restructure? this, learn rst faster if knew markdown . tried google haven't found one.. a small comparsion lot lightweight markup language syntaxs can found on wikipedia . there gist document common markup between 2 languages. you can use pandoc convert existing markdown rest or other way around. there lot of different markdown dialects, may difficult compare syntax rest.

r - how draw ellipses on a scatterplot3d -

Image
i have following data frame: cost quality safety time status 1 13 6 3 4 benchmark 2 10 4 5 10 benchmark 3 8 9 3 9 benchmark 4 7 8 9 9 benchmark 5 4 4 4 2 current 6 2 2 7 11 current i want create benchmark space interms of scatter plot. used scatterplot3d package draw it. scatterplot code: scatterplot3d(f$cost,f$quality,f$safety,f$time,f$status) i got below graph, want draw ellipses benchmarks confidence level of .975.so found dataellips in car package not know how apply function in scatterplot3d. graph want following: i have tried code below, not work; scatterplot3d(dataellipse(f$cost,f$quality,levels=0.68),f$safety,f$time,f$status) because function of dataellips coming car package. error message following: error in xyz.coords(x = x, y = y, z = z, xlab = xlabel, ylab = ylabel, : 'x', 'y' , 'z' lengths differ

PHP Mailer Not Sending Email To Office365 -

i want send mail office365 using phpmailer not sending , giving me connect() error here code: email , password i'm using in real code working require 'mailer/phpmailerautoload.php'; $mail = new phpmailer(); $mail->issmtp(); $mail->mailer = 'smtp'; $mail->smtpauth = true; $mail->host = 'smtp.office365.com'; // "ssl://smtp.gmail.com" didn't worked $mail->port = 587; $mail->smtpsecure = 'tls'; // or try these settings (worked on xampp , wamp): // $mail->port = 587; // $mail->smtpsecure = 'tls'; $mail->username = "email"; $mail->password = "password"; $mail->ishtml(true); // if going send html formatted emails $mail->singleto = true; // if want send same email multiple users. multiple emails sent one-by-one. $mail->username = "mail@gmail.com"; $mail->fromname = "your name"; $mail->addaddress("abc@gmail.com","user 1")...

android.database.sqlite.SQLiteException: No such table exists -

this question has answer here: sqliteexception: no such table exists 2 answers i have sample android app in created database, created table , inserted data table. next day, on opening eclipse ide , running app through emulator, app gets closed, sqlliteexception saying no such table . my mainactivity code follows: sqlitedatabase db = context.openorcreatedatabase( "waterelectricityreadingdatabase.db", mode_world_readable, null); final string create_table = "create table if not exists " + table_name + "(" + column_name_reading_id + " integer primary key autoincrement," + column_name_reading_mode + " text not null," + column_name_pastdatetime + " date not null, " + "enddatetime date not null, " + column_name_readingvalue + " inte...

mysql - simple login php not working -

created simple login form doesnt seem work.it opens admin page. $username=$_post["username"]; $password=$_post["password"]; if(mysql_query("select * users username='$username' , password='$password'",$con)){ session_start(); $_session["username"]=$username; $_session["password"]=$password; header('location:admin.html'); } else{ echo "login failed.<a href=index.html>re login</a"; } need help.and here html part. <form method="post" id="loginform" action="validate.php"> <table> <tr> <td> <label>username :</label> </td> <td> <input type="text" name="username"/> </td> </tr> <br> <tr> <td> <label>password :</label> </td> <td> ...

javascript - Create events object after some data was -

i've several events need listen additional event , pass object: const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr']); ls.stderr.on('data', (data) => { myobj.data = true //here need raise event property data }); ls.on('close', (code) => { myobj.close = true //here need raise event property close }); for example inside of every event want emit my events , send object property. example raise myevent object , every following event update property in object data,close,open let's object var myobj ={ open:true, data:false, close:true } how can this? the obvious way code own small event emitter/listener. const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr']); var eventer = { events: {}, on: function(event, callback){ if(!(typeof callback === 'function'){ return; ...

java - Is there Simple way to use String.toLowerCase() for 9 kinds of languages? -

i need treat 9 kinds of language in list below. dutch english french german italian portuguese russian spanish ukrainian for words in these languages need use tolowercase() . , know need use locale(country, language) parameter of function. then, have use specific locale each language, or there simpler way this? you can construct locale iso 639 language code: locale russian = new locale("ru"); there nice default locales use, example: locale english = locale.english; locale french = locale.french; locale german = locale.german; locale italian = locale.italian; then use string#tolowercase() locale: string lower = str.tolowercase(somelocale);

design patterns - Rails - use code(css, js, html) from server on client side -

i had application rails built bootstrap , simple form. here have show ui patterns how like. means have show patterns menu bar, accordian patterns examples in application. storing pattern code html,css,js in database. here requirement have show actual code pattern view stored record(css,js,html) without css/js conflicts. how can eneter html,css,js code dynamically in partial or page show in fancybox in rails. thanks in advance. just use html_safe or raw render content normal string on views. instance: in controller: @x = your_code_from_db in view: <%= @x.html_safe %> # <%= raw @x %> ok in case notice: can use html_safe on models, raw declared on helper, can use on controllers , views. -- edit -- more example: on controller: @hello = 'alert("hi");' @body = 'body{ background: red; }' on view: <script type="text/javascript" charset="utf-8"> <%= raw @hello %> </script...

datetime - Format date-time as seasons in R? -

in r, it's possible format posixlt date-time objects month: format(sys.time(), format='%y-%m') is there way same thing seasons, or 3-month groups (djf, mam, jja, son)? these divisions common in climatological , ecological science, , great have neat way format them months. djf falls on 2 years, purposes or question, doesn't matter - consistently shove them either year, (or, ideally, able specify year go into). i'm using output index by() , output format doesn't matter much, long each year/season unique. edit: example data: dates <- sys.date()+seq(1,380, by=35) dates <- structure(c(16277, 16312, 16347, 16382, 16417, 16452, 16487, 16522, 16557, 16592, 16627), class = "date") dates #[1] "2014-07-26" "2014-08-30" "2014-10-04" "2014-11-08" "2014-12-13" # "2015-01-17" "2015-02-21" "2015-03-28" "2015-05-02" "2015-06-06" ...

spring mvc - Streaming video from controller to html5 video player -

we trying following upload video s3 bucket stream -- done read stream in java controller -- done use stream play video in html5 video player. --pending note: video size can huge. looking @ best way stream video. when use below code in controller doesn't work stream. instead tries download entire video , tries play content. note works fine videos less 5 mb fails other. there other approaches acheive ? final string contenttype = stringutils.isblank(obj.getcontenttype()) ? mediatype.application_octet_stream_value : obj.getcontenttype(); return responseentity.ok() .contentlength(obj.getcontentlength()) .header("content-type", contenttype) .body(new inputstreamresource(obj.getcontent()));

dataframe - Extracting pixels from a raster based on specific value of another raster using R -

i imported 2 rasters (raster a , b) in r using raster function. extract pixels of a b equals 1 data frame. trying following, however, pixels obtain have same values, although various in original dataset. the 2 rasters have same dimensions (ncols, nrows, ncell, resolution, extent, projection). library(raster) library(rgdal) # import inputs <- raster('/pat/to/rastera.tif') b <- raster('/pat/to/rasterb.tif') # extract raster values on raster b b == 1 mydata <- data.frame(a[b[b == 1]]) edit 1 might when a[b[b == 1]] , class of object , b rasterlayer becomes numeric , , creates problems? discovered doing class(a[b[b == 1]]) , gives numeric . edit 2 ok, weird. tried mydata <- data.frame(a[b]) , output has original a @ b == 1 locations. trying before extracted pixels a (as expect). can coinfirm right counting number of ones in b , number of elements in mydata , same. it's if indexing has skipped zeros in b . can explain this? ...

Questions about copying data into/from Linux Kernel -

i finishing project os class , can't figure several things have safely copying data user-space kernel , kernel user space, , how discard information. say have several system calls: //copies data kernel space long sys_into(void __user *data, long length); // copies data user space long sys_from(void __user *data, long length); in both cases long length number of bytes copied. things able figure out far: 1. validate pointers *data not null . 2. validate length < 0 3. need use access_ok . however, not sure if need use both functions or long sys_into() 3. when copying kernel using kmalloc(length) allocate number of bytes , make sure can allocate memory. 4. use copy_from_user & copy_to_user copy data. so far, found little information. 1. source code example "linux kernel programming" (as pointed out, example in linux kernel development dangerous). 2. http://www.quora.com/linux-kernel/how-does-copy_to_user-work thanks !!! i thi...

jquery - Menu below the logo -

i'd create menu similar this (try in mobile mode): in "desktop" mode, want brand logo , other words on left, , menu on right. in "mobile" mode, block logo , other words, , below menu should take whole row. any suggestion obtain result? link jsfiddle as can see defined css ids, have: display:block one container of logo+words (on left) , 1 container of menu (on right). it not work would, because not know how put menu below brand's name when in mobile mode. i hope result looking for: the css add @media screen , (max-width: 768px) { #logo { display: inline-block; float: none; width:100%; text-align:center; } #nav-logo { display: inline-block; float: none; width:100%; text-align:center; } .navbar-header button { float:none; margin:15px 0px; } } jsfiddle example if want menu above, invert html blocks id="nav-logo" , id="logo" ... the updatade jsfiddle here....

css - Google chrome not rendering page correctly -

here link http://demo.elxer.com/new_eco/ the header (menu , logo section of page not recunstructing correctly on scroll) in google chrome... working fine other browser , google chrome version using google chrome version version 25.0.1364.152 m, please help. might css issue or might jquery or browser rendering issue, have tried lot search no find answer. there not about, i'm afraid. thing helped me out forcing 3d mode with -webkit-transform: translate3d(0, 0, 0); i tried set div under #overlay : <div style="position: relative; top: 0px; min-width: 1150px; max-width: 1280px; height: 4245px; overflow: hidden; margin:0 auto; -webkit-transform: translate3d(0, 0, 0);"> that worked me, brings issue width. maybe easier resolve.

android - Keyboard hides my half of edit-text and button below it even in scroll view -

i having trouble keyboard covers edit-text , half of button in scroll view. here's layout , please tell me how should resolve problem. many questions on topic none of them s working me. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="@drawable/bg" android:layout_height="match_parent"> <scrollview android:layout_width="match_parent" android:fillviewport="true" android:layout_height="match_parent"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <linearlayout android:layout_width="match_parent" android:layout_height="w...