Posts

Showing posts from April, 2012

pandas - alternative to recursive sql / dedupe columns -

hi have data set 1 many relations. want reduce 1-1 concatenating distinct values each column here example: i have data set called customer , product affiliation (pa) . 1 customer can have multiple pa different times. here input: ╔════════╦═══════╦══════╦══════╗ ║ cust ║pa1 ║ pa2 ║ pa3 ║ ╠════════╬═══════╬══════╬══════╣ ║ ║ h ║ m ║ l ║ ║ ║ h ║ l ║ m ║ ║ ║ h ║ m ║ h ║ ╚════════╩═══════╩══════╩══════╝ desired output: ╔════════╦══════╦══════════╦═══════╗ ║ cust ║ pa1 ║ pa2 ║ pa3 ║ ╠════════╬══════╬══════════╬═══════╣ ║ ║ h ║ m&l ║ l&m&h ║ ╚════════╩══════╩══════════╩═══════╝ i have multiple pa columns. want know if there generic python panda code can apply thank minc here's expanded version of sample data make more clear how code operates on groups rather whole dataframe: df = pd.dataframe({ 'cust':list('aaabbb'),'pa1':list('hhhmmh'), ...

CDaoRecordset If a field Exists in MFC C++ -

how check if given field name exists in access database table using vc++ daorecordset. tried google , msdn documentation find useful. i tried following code: bool isfieldexixts(cdaorecordset *rs, cstring fieldname) { colevariant ov; try { rs->getfieldvalue(fieldname,ov); } catch(cdaoexception e) { return false; } return true } but instead of raising exception when not found, displays messagebox stating item not found. i need c++ solution, can find on google vb solutions getfieldvalue not display messagebox. catch block not correct, need catch(cdaoexception *e) { e->delete(); return false; } so in program exception not handled in code. in mfc top level function default handler exceptions invoked , 1 displaying messagebox. btw, check if entry exists in recordset can call cdaorecordset::iseof .

xcode - Dependency between APNS certificate and distribution provisioning profile? -

i have app in app store apns. now, distribution profile broken , can't add device distribution profile. generated profile apple prefix xc:. so 1 solution create new distribution profile new version of app , submit app store. but need create new apns certificate? or work new distribution profile? perhaps actual question is: there relationship between distribution profile , apns certificate? or app id important let apns work? as outlined in push notification guide , ssl certificate used push notifications independent distribution provisioning profile used app. however, need ensure new provisioning profile provides correct entitlements using push notifications , production/development environment, described here . luck.

c# - Pausing in unity -

i trying pause game in unity using timescale , setting 0 when pause panel comes , setting 1 when panel disabled. problem having when pause, buttons on panel not showing animation time scale 0. there anyway around this? or should find way pause without using timescale. appreciated, thanks. a possibility maintain state of game using enum . e.g., define enum as: enum gamestate { started, loading, playing, paused, completed } declare variable of type gamestate in session or place access easy you, compare: if(currentgamestate == gamestate.playing) { // play logic here }

input - Fortran non advancing reading of a text file -

i have text file header of information followed lines numbers, data read. i don't know how many lines there in header, , variable number. here example: filehandle: 65536 total # scientific data sets: 1 file description: file contains northern hemisphere polar stereographic map of snow , ice coverage @ 1024x1024 resolution. map produced using noaa/nesdis interactive multisensorsnow , ice mapping system (ims) developed under directionof interactive processing branch (ipb) of satellite services division (ssd). more information, contact: mr. bruce ramsay @ bramsay@ssd.wwb.noaa.gov. data set # 1 data label: northern hemisphere 1024x1024 snow & ice chart coordinate system: polar stereographic data type: byte format: i3 dimensions: 1024 1024 min/max values: 0 165 units: ...

svn - Cherry picking features -

i've inherited legacy project must remain in svn. originally branch created new release , several bug fixes made , deployed staging server. several times client asks bug 1 , 3 go production server causing lot of headaches. what best branch strategy allow cherry picking of bugs? i have 2 branches: "trunk" , "production". trunk contain latest version bugs fixed. production contain fixes requested production. the development goes in trunk. periodically trunk selectively merged production (you select revisions merge every time).

bash - Env variables not persisting in parent shell -

i have following bash script attempts automate assuming of aws role (i've removed various private settings): #! /bin/bash # # dependencies: # brew install jq # # execute: # source aws-cli-assumerole.sh unset aws_session_token export aws_access_key_id=<user_access_key> export aws_secret_access_key=<user_secret_key> temp_role=$(aws sts assume-role \ --role-arn "arn:aws:iam::<aws_account_number>:role/<role_name>" \ --role-session-name "<some_session_name>") export aws_access_key_id=$(echo $temp_role | jq .credentials.accesskeyid) export aws_secret_access_key=$(echo $temp_role | jq .credentials.secretaccesskey) export aws_session_token=$(echo $temp_role | jq .credentials.sessiontoken) env | grep -i aws_ i have execute script using source because otherwise if use standard bash or sh exported environment variables not available within parent shell executing script. the problem i...

qt - Modal QDialog still allows timers to call slots? -

in qt program, have modal qdialogs meant halt , not continue execution of code until after dismissed. , works function it's in--i put breakpoint on next line of code after qdialog::exec() , doesn't break until after dismiss dialog. however, there qtimer connected slot on timeout, , continue go when modal dialog , execute code in slot. i suppose stop timer before showing modal dialog . however, there may cases when dialog in totally different class timer. there way halt execution of program until qdialog dismissed? example: qtimer* ptesttimer = new qtimer( ); connect( ptesttimer , signal( timeout() ), this, slot( timerslot() ) ); //slot code elsewhere void cmyclass::deletemetimerslot() { qdebug() << "see me during modal?"; } //starting modal dialog ptesttimer->start( 1000 ); qdialog* pmodaldlg = new qdialog( this, qt::dialog | qt::framelesswindowhint | qt::windowstaysontophint ); pmodaldlg->setmodal(true); pmodaldlg->exec(); ...

How to retrieve more than 100000 rows from Redshift using R and dplyr -

i'm analyzing data redshift database, working in r using connection per dplyr - works: my_db<-src_postgres(host='my-cluster-blahblah.redshift.amazonaws.com', port='5439', dbname='dev',user='me', password='mypw') mytable <- tbl(my_db, "mytable") viewstation<-mytable %>% filter(stationname=="something") when try turn output data frame, so: thisdata<-data.frame(viewstation) i error message, warning message: only first 100,000 results retrieved. use n = -1 retrieve all. where supposed set n? instead of using thisdata<-data.frame(viewstation) use thisdata <- collect(viewstation) collect() pull data database r. mentioned in dplyr::databases vignette: when working databases, dplyr tries lazy possible. it’s lazy in 2 ways: it never pulls data r unless explicitly ask it. it delays doing work until last possible minute, collecting want sending database in...

Cross-platform renderer on iOS: control the main loop from C++ class -

i’m porting opengl-based renderer (written in c++) ios , ran following problem: on windows renderer-class has _renderproject (e.g. game i’m making) , _view object again has glfw window. loop in renderer follows: void renderer::runrenderer() { while (_running && _view->isrunning()) { draw((_view->gettime() - _initialtime)); } } the draw function looks this: void renderer::draw(double currenttime) { [...] // call loop function of project if (_renderproject) _renderproject->loopfunction(currenttime - _elapsedtime, currenttime); [...] } now want same thing ios don’t know how loop in renderer class. use cadisplaylink don't know how call c++ memeber function there. update following code written @kazuki sakamoto changed code this: /* main loop using cadisplaylink */ typedef void (^block_t)(double); @interface renderercaller : nsobject { cadisplaylink *_displaylink; } @property (nonatomic, copy) block_t upda...

java - Integrate REST Web Services with Spring Integration -

i have implemented restful web services using spring technologies. now, need integrate these services work on same context using spring integration. how make web services methods endpoints ? how can realize coreography of web services ? how possible transform messages exchanged between web services ? the spring-integration tag has links lots of resources.

configuration - Spring cloud Angel.SR3 not working for config client -

i have application using spring cloud server , spring cloud client. spring cloud server has in pom: <parent> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-parent</artifactid> <version>angel.sr3</version> <relativepath /> <!-- lookup parent repository --> </parent> this version upgraded 1.0.2.build-snapshot, good, problem happened spring cloud client: this current pom parent setting: <parent> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-parent</artifactid> <version>1.0.0.release</version> </parent> with version, env variable can auto injected config service, once change angel.sr3, auto injection failed immediately, can not inject environment variable @ all. is there wrong spring cloud here? after 1.0.0.release need include org.s...

sql server - this sql query works in mysql but not in mssql -

mysql: select * (select * songs order artist asc) songs2 artist 'a%' group artist` mssql: select * (select top 1000 * songs order artist asc) songs2 artist 'a%' group artist this works in mysql in mssql error: column 'songs2.id' invalid in select list because not contained in either aggregate function or group clause ++++++++++++++++++ select query : select artist,album,song (select top 1000 * songs order year asc, artist asc) songs2 artist 'a%' group artist,album,song; not group artist, want 1 artist per song available in query this find 1 song per artist , maximum of 1000 songs: select top 1000 artist,album,song ( select artist,album,song, row_number() on (partition artist order (select 1)) rn table_name artist 'a%' ) t2 rn = 1

ios - Using Auto Layout, give an object a dynamic size based on the screen size -

in xcode storyboard, have image view, , have large image in it. let's set 500 pixels 500 pixels. yet, don't want large on small screens, , screens in both landscape , portrait. how can shrink fit on small screens, yet still expand 500x500 on larger screens? you can set childview's width percentage of superview in storyboard (maybe set multiplier 500:768 right you). also there blog that .

c# - How to distribute a cost in a normal distribution -

i've found guides on programmically getting random numbers generate normal; however, need spread out number reflects normal distribution (in least calculation time possible). for example, have item cost $500,000 in year 2050 , spread across standard deviation of 20 years. result in area under first standard deviation (year 2030 2070) having (68% * $500,000) of cost. is there formula can use in code achieve this? way can think of right using box muller random generator , loop through each dollar generate distribution, not efficient. note total value under normal distribution 1. therefore, need find out percentage of curve accumulates in timeframe , multiply total cost. instead of normal distribution, want normal cdf (cumulative density function) ( here in c# ). so, sum up: find cost given range of years, find normalized values years, plug them cdf function, , multiply total cost: start = (start_year-0.5-median)/stddev; end = (end_year+0.5-median)/stddev; cost ...

swift - SceneKit server-client non-rendering scene -

i'm working on server-client based networked game in scene kit. since server , client have duplicate copies of game, i'm loading same scenes scnscene on client side , scnscene on server. however, have yet find way run physics simulation on server's copy of scnscene without rendering in scnview. how can set (custom scnrenderer?) drives simulation without rasterizing frames?

mysql - SQL Select All Record In Each Group (Name, DOB) -

i have table id dob amount receiver_name sender_name settle_fee columns. sample data id dob amount receiver_name sender_name settle_fee ------------------------------------------------------------------- 1 10-06-1990 100 jose benn 12 2 12-06-1990 200 jim mike 12 3 10-06-1990 300 kate benn 12 4 12-06-1990 100 amy mike 12 5 10-06-1990 200 alison benn 12 6 12-06-1990 300 mary mike 12 expected result id dob sender_name --------------------------- 1 10-06-1990 benn |--------amount receiver_name settle_fee 100 jose 12 300 kate 12 200 alison 12 2 12-06-1990 mike |--------amount receiver_name settle_fee 200 jim 12 100 amy 12 ...

javascript - Sortable and deletable select list -

so need make select element able move , drag around sortable ol/uls able done. e.g. jqueryui . here dummy select element work on. button next each word cross remove list. having looked around seems sortable available uls , ols though. my dummy code: <select size="10"> <option value="ca" >value 1</option> <option value="co" >value 2</option> <option value="cn" >value 3</option> <option value="cn" >value 4</option> <option value="cn" >value 5</option> <option value="cn" >value 6</option> <option value="cn" >value 7</option> <option value="cn" >value 8</option> <option value="cn" >value 9</option> <option value="cn" >value 10</option> <option value="cn" >value 11</option> <option value="cn" >value 12</op...

javascript - How to change colour of text when using document.getElementById("id").innerHTML -

i trying change text of span else when particular event occurs. doing : document.getelementbyid("usernameerror").innerhtml = "**message"; i want display same in different colour. idea on how that? appreciated! you put message in span , put style attribute on it. should it: document.getelementbyid("usernameerror").innerhtml = "<span style='color: red;'>**message</span>";

php - Mocking class parameter that returns a mock in Laravel 5.1 -

i new unit testing , trying test controller method in laravel 5.1 , mockery. i trying test registeremail method wrote, below <?php namespace app\http\controllers; use illuminate\http\request; use response; use mailchimp; use validator; /** * class apicontroller * @package app\http\controllers */ class apicontroller extends controller { protected $mailchimplistid = null; protected $mailchimp = null; public function __construct(mailchimp $mailchimp) { $this->mailchimp = $mailchimp; $this->mailchimplistid = env('mailchimp_list_id'); } /** * @param request $request * @return \illuminate\http\jsonresponse */ public function registeremail(request $request) { $this->validate($request, [ 'email' => 'required|email', ]); $email = $request->get('email'); try { $subscribed = $this->mailchimp->lists->s...

xml - odoo - xpath not shown -

code: <openerp> <data> <template id="report_saleorder_insurance_inherit" inherit_id="sale.report_saleorder_document"> <xpath expr="//div[@class='row']/div[@class='col-xs-4 pull-right']/table/tr[2]" position="after"> <tr> <td>insurance</td> <td class="text-right"> <span t-field="o.amount_insurance" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> </td> </tr> </xpath> </template> </data> </openerp> this code should add additional row sales order costs, after updating nothing shows. have added xml __openerp__.py file , restarted service after that. module updates without errors. @ loss why not working. did forget something? the xpath should add...

Getting the content of a variable from php to android and display it using Toast class -

i want content of variable php android , display using toast class. wrote following codes , if 1 or both fields empty, register.php file prints $isempty , java code should content of $isempty variable , if(text == "isempty") result toast class should display r.string.empty . program using following codes can not display r.string.empty using toast class. public class mainactivity extends activity { edittext username, password; button register; string name, pass; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); username = (edittext) findviewbyid(r.id.edittext); password= (edittext) findviewbyid(r.id.edittext2); register= (button) findviewbyid(r.id.register); register.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { try{ ...

angularjs - Using Restangular in the App using the factory -

i have created here working demoapp in have used restangular it working fine when tired implement demoapp factory data doesnt seem come , cant check out possible bug in /* file containing json object*/ [ {"id":1, "subject":"#aashima" }, {"id":2, "subject":"#aansh" }, {"id":3, "subject":"#artle" }, {"id":4, "subject":"#harish" } ] <!doctype html > <html ng-app="app"> <head> <meta charset="utf-8"> <title>restangular</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.16/angular.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-mi...

c++ - Why Pointer+Pointer is not allowed but Pointer+integer allowed? -

this question has answer here: addition of 2 pointers in c or c++ not supported. why? 3 answers i going through c pointer arithmetic. found pointer addition not allowed pointer + integer allowed. i thought pointer + pointer not allowed due security reason. if pointer p1 holds 66400 , p2 holds 66444 . p1+p2 not allowed p1+66444 allowed. why so? think way. address 1: 112, bakers street address 2: 11, nathan road why address1 + 3 fine address1 + address2 bad. (btw address1 + 3 mean 115, backers street) for same reason multiplication of scalar or address address doesn't make sense. address1 * 2 // invalid address1 * address2 // invalid logically possibly take offset address adding/subtracting adding 2 addresses doesn't make sense because addresses of same variables may different in each run of program. type , value of addition don...

asp.net mvc - Encountered Validation Error in double? datatype in MVC3 C# -

hi guys new mvc 3 , while debugging project, encountered error in field of miles , , unusual error appeared says the field miles must number. upon entering .2 , 135. whereas automatic value before , after decimal point zero, preventing me saving values , i'm here searching solutions. i hope can me this. this code snippet: <div> <div class="label"> @html.labelfor(m => m.miles) @html.validationmessagefor(m => m.miles) </div> <div class="field"> @html.textboxfor(m => m.miles) </div> </div> and here datatype in model: public nullable<double> miles { get; set; }

python - Combining two dictionaries by merging its values in a sorted list -

i'm having trouble writing function union_collections consumes 2 dictionaries (d1 , d2) representing 2 book collections. function produces new dictionary containing books present in d1 or d2, while maintaining following rules: the produced dictionary should not contain duplicate book titles. each list of book titles within produced dictionary should sorted using built- in sort() method. cannot use built-in function fromkeys() in solution these sample collections testing: collection1 = \ {'f':['flatland', 'five minute mysteries', 'films of 1990s', 'fight club'], 't':['the art of computer programming', 'the catcher in rye'], 'p':['paradise lost', 'professional blackjack', 'paradise regained'], 'c':['calculus in real world', 'calculus revisited', 'cooking one'], 'd':['dancing cats', ...

How to do Unit test for Asp.net which of type website? -

i created asp.net website not project. unit testing website. created unit test project problem arises when tried reference website i.e., website reference not coming while adding reference. you cannot directly unit test asp.net website project due website project compiles @ runtime , unit test require reference classes part of compiled dll. options have available are: convert website web application project , unit test accordingly. or move relevent code app_code library project , reference dll website project. both of above options provide access classes in compiled dll format can can used unit test. i hope helps

android - how to scroll two gridview and an imagview inside scrollview together -

i having 2 gridview , imageview inside scrollview, want scroll these views together. the first gridview have 4 items , second gridview having more 4 items. so possible scroll together. my layout is, <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="170dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" > </android.support.v4.view.viewpager> <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" an...

Displaying content of a file in C++ -

i've made program using can add records in file order, displaying of file after adding record not working . if add "|ios::app" in "ofstream fo" open file in append mode, displaying "fin" working. why so? i'm using mingw4.8.1 #include<fstream> #include<iostream> #include<stdio.h> class c{ public: int r; char nm[20]; }; using namespace std; int main() { c a,b; ifstream fi("old.txt",ios::binary); ofstream fo("new.txt",ios::binary); // if |ios::app added here, // display fin below working fine cout<<"enter roll\t"; cin>>b.r; cout<<"enter name\t"; fflush(stdin); gets(b.nm); int w=0; while(true) { fi.read((char *)&a,sizeof(a)); if(fi.eof()) break; if(b.r<a.r&&w==0) { fo.write((char *)&b,sizeof(b)); ...

Visual Studio F# error - FSharp.Core.sigdata -

i've installed latest fsharp bundle, whenever hit control-spacebar in visual studio, error: problem reading assembly 'fsharp.core, version=4.3.1.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a': error opening binary file 'c:\windows\microsoft.net\assembly\gac_msil\fsharp.core\v4.0_4.3.1.0__b03f5f7f11d50a3a\fsharp.core.dll': fsharp.core.sigdata not found alongside fsharp.core edit 1 also, when try compile, following errors: fsc: error fs1223: fsharp.core.sigdata not found alongside fsharp.core fsc: error fs0229: error opening binary file 'c:\windows\microsoft.net\assembly\gac_msil\fsharp.core\v4.0_4.3.1.0__b03f5f7f11d50a3a\fsharp.core.dll': fsharp.core.sigdata not found alongside fsharp.core fsc: error fs3160: problem reading assembly 'fsharp.core, version=4.3.1.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a': error opening binary file 'c:\windows\microsoft.net\assembly\gac_msil\fsharp.core\v4.0_4.3....

javascript - How to make square in Twitter Bootstrap around the item? -

Image
i trying make web page show in image .i able make 90%.but have 1 issue how make square shown in image (a square have triangle in bottom.i know can make square using border .but how make triangle in bottom triangle how make contend scrollable mean contend not scrolling use overflow:auto , scroll ) .bg { background: #597a4d!important; width: 100%!important; } .nav_bar { background: #597a4d!important; border-style: none; height: 44px; border: 0px!important; border-radius: 0px!important; } .display_menu li a{ font-size: 1.2em!important; color: #ffffff!important; } ul.display_menu li:last-child{ background:#3c86d7; } .rowclass { display: block; margin-top: 3%; } .rowclass >div { padding: 3em; text-align: center; } .text_row div{ display: block; border: 1px ; padding: auto; color: #ffffff; margin-top: 3%; } .rowclass span { display: block!important; color: #ffffff; } .logo_image{ width...

jsf 2 - Simple demo ajax JSF page does not work (Richfaces 4.2.3 with Geronimo v3.0.1) -

Image
i new javaee , trying setup project using richfaces 4.x geronimo v3. i copy source richfaces showcases ( here ) page cannot function until press enter, seems ajax / event not working in case. there warning: page /test.xhtml declares namespace http://richfaces.org/a4j , uses tag a4j:ajax , no taglibrary associated namespace. not sure why warning. i using eclipse luna build , deploy application. library included: i not sure choose right combination of technology, aim make application run on websphere v8.5.5. thanks. updates : 500 after adding richfaces 4.2.3 web-inf/lib exception javax.servlet.servletexception javax.faces.webapp.facesservlet.service(facesservlet.java:229) root cause java.lang.reflect.invocationtargetexception sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) sun.reflect.delegatingconstructoraccessorimpl.newinstance(...

How to render image in my Django Blog Template? -

hi guys have blog setup , want add ability image or thumbnail included in every blog post. i'm having trouble getting location of file , blog template match , show image. i'm having difficulties integrating imagewiththumbnail model entry model. post.html {% include 'head.html' %} {% include 'navbar.html' %} {% load staticfiles %} {% load django_markdown %} <div class="container"> <div class="post"> <h2><a href="{% url "entry_detail" slug=object.slug %}">{{ object.title }}</a></h2> <p class="meta"> {{ object.created }} | tagged under {{ object.tags.all|join:", " }} <p> created {{ object.author }} </p> </p> {{ object.body|markdown }} <img src="{% static "{{ static_root }}/media/tableau_public.jpg" %}" alt="my image"/> {{ object.file }} </div> {% inc...

vxworks - Does call to taskSpawn() blocks until the spawned task completes -

i rather new vxworks(i using version 6.7), , find when spawn child task, parent seems block till child task completes. perhaps, understanding not correct, , there parameter set in taskspawn(), telling not block till code task had completed. there such parameter or there other mechanism bit make parent task wait completion of child? you should check priorities tasks. default vxworks scheduler priority-based preemptive scheduling.

ios - The SubView's background is lost -

Image
my application's structure follow: uitabviewcontroller: first uiviewcontroller: uipageviewcontroller: - page1: uiviewcontroller: - uiview: contains uilabels, 1 uibutton - page2: uiviewcontroller: - uiview: contains uilabels, 1 uibutton second uiviewcontroller: the uiview added programmatically in uiviewcontroller: - (void)viewdidload { [super viewdidload]; // additional setup after loading view. sessionview* b = [[[nsbundle mainbundle] loadnibnamed:@"sessionview" owner:self options:nil] lastobject]; cgrect frame = b.frame; b.frame = cgrectmake(0, 88, frame.size.width, frame.size.height); [self.view addsubview:b]; } the weird thing uiview appears without background color. , button cannot tapped. i upload source code here in case want check. i working on ios8, xcode6, ipad thanks lot. try : [mainview bringsubviewtofront:subview];

javascript - How to check if any span element in inside div has empty value -

i have below code in html file <div id="tags" style="border:none"> <span class="tag" id="spantag">{{ stu_skill.skill }}</span> </div> values inside above span added dynamically server.. there maximum of 7 spans (spans[0],spans[1] , on till spans[6]) how can check if of spans empty in javascript or jquery ? so far, tried below didn't through var div = document.getelementbyid("tags"); var spans = div.getelementsbytagname("span"); if (spans[0].innerhtml.length == 0) { spans[0].innerhtml=="empty"; } like this, , also if($('spans[0]').text().length == 0){ $(".tag").text("empty"); window.alert("spans[0] has no value, " + $(".tag").value); } i'm trying check if there empty span, if found, need update string "empty" or " " could please suggest right approach ? voilà, jquery has everything need ...

android - NullPointerException while inflating custom toast message in shouldOverrideUrlLoading() method -

i have app displays webview , every time url loads in webview try show custom toast message says "please wait".. inflate custom toast message in shouldoverrideurlloading(webview view, string url) method.. app works fine if start app , wait url load..and message appears while loading url.. the problem comes when start application , exit it.. without waiting url load.. app crashes giving me null pointer exception @ -- layoutinflater iflater = (layoutinflater)getactivity().getsystemservice(context.layout_inflater_service); i'm not able figure out way prevent exception , app crashing- here code- public boolean shouldoverrideurlloading(webview view, string url) { log.i(tag, "about load:" + url); view.loadurl(url); layoutinflater nflater = (layoutinflater)getactivity().getsystemservice(context.layout_inflater_service); view layout = nflater.inflate(r.layout.toast2, (viewgroup) getactivity().findviewbyid(r...

Android : What is the difference between converting Bitmap to byte array and Bitmap.compress? -

i uploading image (jpeg) android phone server. tried these 2 methods - method 1 : int bytes=bitmap.getbytecount(); bytebuffer bytebuffer=bytebuffer.allocate(bytes); bitmap.copypixelstobuffer(bytebuffer); byte[] bytearray = bytebuffer.array(); outputstream.write(bytearray, 0, bytes-1); method 2 : bitmap.compress(bitmap.compressformat.jpeg,100,outputstream); in method1, converting bitmap bytearray , writing stream. in method 2 have called compress function given quality 100 (which means no loss guess). expected both give same result. results different. in server following happened - method 1 (the uploaded file in server) : file of size 3.8mb uploaded server. uploaded file unrecognizable. not open image viewer. method 2 (the uploaded file in server) jpeg file of 415kb uploaded server. uploaded file in jpeg format. difference between 2 methods. how did size differ though gave compression quality 100? why file not recognizable image v...

How do you display Greek symbols in mpld3 (Python Matplotlib D3) plots? -

the conventional plt.title(r'$\alpha$') instance not work in mpld3.enable_notebook(), whereas in normal matplotlib.pyplot. this 1 of many features of mpl not yet supported in mpld3 . great have, , steps towards implementation have been recorded here . patches welcome!

linux - gSOAP Chaining C++ Server Classes to Accept Messages on the Same Port Not Working -

we have 6 wsdls compiled within same project, , due limits of hardware can open 1 port listening. for doing this, choose approach described chapter 7.2.8 how chain c++ server classes accept messages on same port in gsoap manual . however, when using approach in encounter many sever issues: 1. if lots of requests arrive concurrently, soap_begin_serve reports error error=-1, socket closed soap server after established 2. if call xxx.destory() after soap_free_stream(), soap_accept() report error of bad file descriptor , not work anymore (solved) anybody knows reasons of above phoenomenon? how solve them? our code close example except few changes, see below section. //server thread abc::soapabcservice server; // generated soapcpp2 -i -x -n -qabc server.bind(null, 12345, 100); server.soap_mode = soap_keep_alive | soap_utf_cstring; server.recv_timeout = server.send_timeout = 60; while (true) { server.accept(); ... pthread_create(&pid, null, ...

Integrate python scripts in c++ app -

i need extend c++ app python scripts i'm unsure interface library should use. basic communication is: c++ app registers class methods script (so loaded module in script), calls specific function in python script. script should perform task while being able call c++ methods. when script has finished, c++ app should able use return value of script (e.g. std::list). from i've read boost.python pretty powerful , considering fact use boost, seems way go. in documentation, have not seen way expose class methods (static or not) python script. is possible? how can that? edit : ok, think should have been little more specific, sorry. know how import python libraries etc. c++ code , i've taken boost documentation regarding embedding didn't got looking for. for clarity, workflow in scenario: c++ app starts running at point, c++ class needs support specific python script located somewhere @ defined plugin-location on hard disk. before calling script, c++ class wan...

sql - How to get the right output from this query -

im creating sql query outputs licenseplate dbo.car when there stock of car. means have under dbo.sell , dbo.rent make sure car not sold or under rental. i need have output following: licenseplateno -------------- sgk5556a but output blank. have following statement: select licenseplateno car inner join cartransaction on car.chassisno = cartransaction.chassisno inner join sell on cartransaction.transactionid = sell.transactionid inner join rent on cartransaction.transactionid = rent.transactionid car.make = 'toyota' , sell.transactionid in (select transactionid sell) , rent.transactionid in (select transactionid rent) i cant seem right query. moment when query works when did not specify query dbo.rent. need validate whether if car available through rental history the inner joins not needed , car never in sell , rent @ same time, query can written as: select licenseplateno car inner join cartransactio...

c++ - Call to AfxOleTerm in a MFC application prior to using a DLL -

in mfc application, afxoleinit() method called in application initinstance() method. need call method because using ole objects in application. i using dll doesn't work if afxoleinit() has been called. i thinking about: calling afxoleterm() prior loading dll, doing have dll, calling afxoleinit() afterwards (in main program, not in dll). is acceptable solution? note in practice, if this, dll behaves properly. calling afxoleterm prior dll calls no idea. reason simple: doing may cause created com objects thread destroyed, or nay not accessible longer. anyway calling afxoleinit inside dll no idea. problem is, call specific thread. only application should call afxoleinit in thread , should perform further action. and make more complicated, depends on model of mfc using. sharing mfc in dll cause afxoleinit act different using statically linked dll.

Unable to call C# method in javascript -

i want call webmethod( c# method) in aspx page in javascript ajax call. in url can pass test.aspx/mymethodname [webmethod] [scriptmethod(usehttpget = true, responseformat = responseformat.json)] public static string loadsites() { var jsondata = jsonconvert.serializeobject(lstsitename); // test.visible = true; return jsondata; } $(document).ready(function () { loadgrid = function () { alert('loading grid data'); jquery("#grid").jqgrid({ mtype: 'post', url: 'test.aspx/loadsites', contenttype: "application/json; charset=utf-8", datatype: "json", colnames: ['sitename', 'description' ], colmodel: [ { name: 'sitename', index: 'sitename' }, { name: 'description', index: 'description' } ], sortname: "sitename", rownum: 10, ...

dockerhub - AWS - automatically pick new versions of a container -

ok, have created ec2 container service cluster, task definition , able run task. it's simple website in container. whenever push changes bitbucket, docker hub picks source , builds new image. task definition in aws points automatically built docker image; picks when starting. when image changes nothing happens. what need make ec2 cs pick latest container version? if restart ecs container instance, pull latest image (provided have not specified tag, else pull last version of tagged image). if want deploy new version of image, best thing create new version of task definition, without changing , update service , pick last task definition version created. it documented in second paragraph of page : http://docs.aws.amazon.com/amazonecs/latest/developerguide/update-service.html

ios - Parse signup validation -

i using parse handle user registration in swift-app building. started have been following tutorial: http://blog.bizzi-body.com/2015/02/10/ios-swift-1-2-parse-com-tutorial-users-sign-up-sign-in-and-securing-data-part-3-or-3/ in end states should consider adding: " form validtion , must add validation every place user can type something." my sign code looks this: @ibaction func signup(sender: anyobject) { self.processsignup() } func processsignup() { var useremailaddress = emailaddress.text var userpassword = password.text // ensure username lowercase useremailaddress = useremailaddress.lowercasestring // create user var user = pfuser() user.username = useremailaddress user.password = userpassword user.email = useremailaddress user.signupinbackgroundwithblock { (succeeded: bool, error: nserror?) -> void in if error == nil { dispatch_async(dispatch_get_main_queue()) { self...