Posts

Showing posts from June, 2011

javascript - Login form in iframe from Aliexpress doesn't work in PhantomJS -

i'm trying login aliexpress through phantomjs, script doesn't work , can't figure out why. i'm using phantomjs version 2.0.0. the login form inside iframe, maybe that's problem. this code: var page = new webpage(), step = 0, loadinprogress = false, timeout = false; var url = 'https://login.aliexpress.com/buyer.htm?spm=2114.11040108.1000002.7.8yvuzj&return=http%3a%2f%2fcl.aliexpress.com%2f'; function fill , submit form inside i-frame. var sendform = function(){ var iframeref = function( frameref ) { return frameref.contentwindow ? frameref.contentwindow.document : frameref.contentdocument; }; var iframe = iframeref(document.getelementbyid('alibaba-login-box')); var arr = iframe.getelementbyid('login-form'); arr.elements["fm-login-id"].value="my-email"; arr.elements["fm-login-password"].value="my-password"; iframe.getelementb

javascript - Rails and CORS: why am I only seeing the OPTIONS request? -

i having horrible time trying cors working in json api rails app. i have event model , associated controller. event s belong registeredapplication s. # routes.rb rails.application.routes.draw root 'registered_applications#index' resources :registered_applications namespace :api, defaults: { format: :json } # option http verb match '/events', to: 'events#create', via: [:options] resources :events, only: [:create] end devise_for :users end # events_controller.rb class api::eventscontroller < applicationcontroller skip_before_filter :verify_authenticity_token before_filter :cors_preflight_check after_filter :cors_set_access_control_headers # if preflight options request, short-circuit request, # return necessary headers , return empty text/plain. def cors_preflight_check if request.method == :options headers['access-control-allow-origin'] = '*' headers['access-control-allo

html - DIV has multiple classes assigned, but I want to apply a style to only one of those classes, is it possible? -

here envision doing: <div class="a1 a2" style="width:15%"> text </div> now .a2 colorized bar overlay text, variable width (which why need declare width in html). in example, need a2 15% width. still need .a1 remain 100% width (which declared in css). is @ possible or going wrong way you should create 2 different div containers: <div class="a1"> <div class="a2"> content </div> </div> then apply style each respective class.

HighCharts in R Shiny App -

i using highcharts in shiny app. when have following, works. fluidrow( tags$head(tags$script(src = "https://code.highcharts.com/highcharts.js"), tags$script(src = "https://code.highcharts.com/highcharts-more.js"), tags$script(src = "https://code.highcharts.com/modules/exporting.js"), tags$script(src = "https://code.highcharts.com/modules/heatmap.js"), tags$style(type="text/css", ".shiny-output-error { visibility: hidden; }", ".shiny-output-error:before { visibility: hidden; }") however goal not go through highcharts website , access highcharts folder locally. placed highcharts folder in root directory , did following. fluidrow( tags$head(tags$script(src = "/highcharts/js/highcharts.js"), tags$script(src = "/highcharts/js/highcharts-more.j

sql - How to include user in MySQL query? -

i have query returns list of every post exists, comments (concatenated), , how many likes has. i include column that indicates whether or not user has upvoted/liked specific post. structure of relevant tables follows: likes (id, elementid, googleid) elements (id, googleid, time, title, body, type) comments (id, elementid, googleid, body) so how go through likes, determine if 1 of them has user's id (dynamically put query via node.js), , create column indicating simple true or false? select e.id, e.time, e.title, e.body, e.type, c.comments, e.googleid, l.likecount elements e left join( select elementid, group_concat(body separator '|-|') comments comments group elementid ) c on c.elementid = e.id left join ( select elementid, count(id) likecount likes group elementid ) l on l.elementid = e.id; add left join against likes , passing user's googleid join's on clause. if values join non-null, user has liked post. if null,

google search appliance - Extracting directory structure as metadata using entity recognition -

i attempting extract values within url pattern , apply them metadata using regular expressions , entity recognition applied url . url: https://example.com/folder1/folder2/folder3/folder4/page.html regex: https:\/\/example\.com\/folder1\/folder2\/([^\/]*).*[^\/]*\/ this should extract folder3 . has been tested , works on regex101 , using reggyapp.com (which uses google re2 engine, gsa uses) https://regex101.com/r/af2jr0/2 however when uploading gsa entity recognition file not recognise it. <?xml version="1.0"?> <instances> <instance> <name>ignoredname</name> <pattern>https:\/\/example\.com\/folder1\/folder2\/([^\/]*).*[^\/]*\/</pattern> <store_regex_or_name> regex_tagged_as_first_group </store_regex_or_name> </instance> </instances> by default, gsa's entity recognition stores text extracted pattern. can remove following portion xml. <store_regex_or_nam

xcode - SpriteKit: Wrong resolution when transition to another Scene -

when present new scene has very low resolution. have set resolution correctly in scene editor. think it's bug of xcode7 beta 6. or made mistake? override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { if let view = view { let scene = gamescene(filenamed: "gamescene") view.presentscene(scene) } }

google app engine - How to implement a GCM Hello World for Android using Android Studio -

i have been searching days how implement google cloud messaging android, i'm serious doubts it. i mean, apparently google put informations online, here , here , i'm confused logic. 1 page talks client side, , server side. great, how bind of together? how implement http and/or xmpp protocol communicate gcm connection server(s)? i implement basic helloworld gcm, work following steps: 1. app send message (say "helloworld") gcm; 2. receive message gcm , add textview. what steps needed achieve basic app? thank you, if have read 2 links in question , understood gcm key concepts, can refer following sample codes: of course, let's assume have finished: create project , server api key @ google developers console set permissions in androidmanifest files <uses-permission android:name="android.permission.internet" /> server side: public class mainactivity extends appcompatactivity { private textview mtextview; @ove

Pass org-mode table data into org-mode C++ source code block -

how access org-mode table data in c++? #+tblname: prob-calc | | 353.02 | | b | 398.00 | | c | 241.0 | | d | 1 | #+begin_src c++ :var tbl=prob-calc :includes <stdio.h> :results output // in other languages, python, can evaluate tbl // see values (and of course access them in usual python // way. same r, common lisp. possible c++? // suspicion can't done in c++. // goes here it? #+end_src thanks in advance this seems work: #+tblname: prob-calc | | 353.02 | | b | 398.00 | | c | 241.0 | | d | 1 | #+begin_src c++ :var tbl=prob-calc :includes <iostream> <cstdlib> :results output int row, col; (row=0; row < tbl_rows; row++) { (col=0; col < tbl_cols; col++) { std::cout << tbl[row][col] << " "; } std::cout << "\n"; } #+end_src #+results: : 353.02 : b 398.0 : c 241.0 : d 1 on linux, source file written in /tmp/babel-<mumble>/c-src-<mumble>.cpp , , table declaration in

It's possible to make a Batch program that backup a folder files from my external hd to pc hdd, anytime I add or change a file? -

i'm graphic designer , use external hd move psd/jpeg/png/tiff files laptop @ home work pc , vice versa. precaution before modifying or adding file copy folder. it's possible make automatically? , it's easy make on batch? thanks help! robocopy friend google , have look. it's powerful program sysinternals (owned microsoft). or if want nice gui go use synctoy ( https://www.microsoft.com/en-gb/download/details.aspx?id=15155 ) can run batch file (including arguments) or made scheduled task.

Dailymotion API - CORS: Server has Access-Control-Allow-Origin: * but ajax request is not going through browser same-origin -

Image
this possibly problem dailymotion api appears: see here: jquery ajax request being block because cross-origin in above question, solution jsonp, not work here post request. from test request outside browser, appears server accept cors requests, ajax requests consistently fail, no matter how fiddle options. my ajax settings: type:"post", //i tried without parameter xhrfields: { //i tried false withcredentials: true }, processdata: false, //i tried correct content type of 'multipart/form-data', contenttype: false, //i tried enabled(and without) //crossdomain:true, sample request outside browser (notice cors settings good) post /upload?uuid=21dddfd208868ec5ee38c0f641aa0a43 http/1.1 user-agent: curl/7.35.0 host: upload-01 . sv6 . dailymotion . com accept: */* content-length: 139 expect: 100-continue content-type: multipar

arrays - Sudoku Checker in C Issues -

i have sudoku checker assignment class , task able create code ask how many puzzles user solve they'll input of numbers themselves. after input numbers, output either "yes" or "no" in response if puzzle(s) correct. far i've been able manipulate code let user input of numbers i'm stuck on how able check if each number in same row, column, , 3x3 square not repeated. tips on how me started on checking grateful because i'm stumped on part. heres code far #include <stdio.h> #define col 9 int main (void) { int n, i, j,array[100][col]; int check=0; scanf("%d", &n); //enter how many puzzles want solve //for loop goes through every position in puzzle(s) for(i=0;i<n*9;i++) { for(j=0;j<col;j++) { //array[i][j]=0; //printf("array[%d][%d]=%d\n", i,j,array[i][j]); scanf("%d", &array[i][j]); //user entry puzzle(s) } } return 0; } first, don't need array of size

multithreading - Java ExecutorService - why does this program keep running? -

i'm trying build background task executor terminates background tasks after time if there's no answer (background tasks call webservices , can time-out need make sure time out under time) so have experiment if run program not terminate. wonder if because background thread still active maybe? how can shut down? public class test { public static class task implements callable<object> { @override public object call() throws exception { while(true) {} } } public static void main(string[] args) { try { task t = new task(); executorservice executor = executors.newsinglethreadexecutor(); executor.invokeall(arrays.aslist(t), 5l, timeunit.seconds); executor.shutdown(); system.out.println("done"); } catch (interruptedexception e) { e.printstacktrace(); } } } the executorservice not kill running threads, , since threads created non-daemon, jvm doesn't exit. wh

java - caching a value common to two jvms -

i storing key value property using ehcache. used in java program x. using java program y, want use same key value pair. read , may update key value pair 1 of 2 java programs x or y. both x, y run @ same time. you use distributed cache or ehcache replication. start thinking choose read this . personaly prefer distributed cache , because more flexible , easer use. need setup tsa server , configure caches use server.

mysql - SQL SELECT and PHP retrive speed INT vs TINYINT vs VARCHAR vs ENUM? -

i'm in process of creating table display records , made me wonder. if store, 'eating habits' has make (vegetarian, non-vegetarian , eggetarian), make difference on query speed if store 'eating_habits' int or tinyint or varchar or enum type. so using int [approach 1] // select records select * table eating_habits = 2 , ...; //for display in php foreach($all_records $key => $val) { if($val['eating_habits'] == 1) echo 'vegetarian'; elseif($val['eating_habits'] == 2) echo 'non-vegetarian'; else echo 'eggetarian'; } faster/slower - using tinyint [approach 2] // script same above aproach 1 .... faster/slower - using int or tinyint join****[approach 3] // select records select *.t1 table1 t1 join table2 t2 on ti.eat_habit_id=t2.eating_habits t2.eating_habits = 2 , ...; //for display in php foreach($all_records $key => $val) { echo $val['eating_habits']; } faster/

javascript - Trouble removing duplicates from list -

//get email test area var emaillist = document.getelementbyid("emailtextarea").value; var emaillistarray = emaillist.split("\n"); //remove yahoo , duplicates list var usernamesarray = emaillistarray.map(function(val, index, arr) { return val.slice(0, val.indexof('yahoo.com')); }); assuming: emaillistarray = ['123@gmail.com','123@yahoo.com','123@gmail.com','123@hotmail.com'] you can this: var usernamesarray = []; emaillistarray.foreach(function(item) { if(usernamesarray.indexof(item) < 0 && item.indexof('yahoo.com') < 0) { usernamesarray.push(item); } }); first condition checks if element in turn not in array of results, second condition checks if element doesn't contain substring yahoo.com , if both true , element added results. after that, usernamesarray should have: [ '123@gmail.com', '123@hotmail.com' ]

ember.js - Add Ember Data query helper method -

i'm using ember api json api backend. api accepts filters this: /users?filter[simple][name]=john right now, whenever want make query, i'm doing this: this.store.query('users', { filter: { simple: { name: 'john' } } }); it nice avoid verbosity adding helper function works this: this.store.simplequery('users', { name: 'john' }); that function pass arguments directly query() , wrapping query in { filter: { simple: ... } } . is possible? how do this? well stopping creating own method in adapter that? // ... adapter code simplequery: function(modelname, query) { return this.store.query('users', { filter: { simple: { name: 'john' } } }); } // ...

c - Present error messages for invalid data entry -

this first project (kind of text based game). how present error messages when text entered in area numbers prompted , vice versa. or possibly ability reject improper input altogether. #include <stdio.h> #include <stdlib.h> int main() { char name[20]; char q1; int q2[2],q3[2]; float qt[3]; for(q1='n';q1!='y';) { printf("what name?\n"); gets(name); printf("you have entered: "); puts(name); printf("is okay? [y/n]\n"); scanf("%s",&q1); if(q1!='y'&&q1!='n') printf("user error: '%c' not recognized.\nplease enter 'y' continue or 'n' edit name\n",&q1); if(q1!='y'&&q1!='n') scanf("%s",&q1); } printf("okay, %s.",name); printf(" out of 3 choices most?\n1. start garden.\n2

serialization - Java Serializable objects -

this question has answer here: what serialversionuid , why should use it? 22 answers i have started work sending data on sockets past few weeks. started sending multiple strings data , parsing data floats or ever type needed for. on time noticed client start slow down because reading , converting multiple strings , using them while server dishing them out. began sending serializable objects work , great have questions them. public class packet implements serializable{ private static final long serialversionuid = -7896044384334791233l; //data here } a class send looks data want send. removing serial versionuid creates error. serialversionuid , if same in objects sending why 1 long necessary program work? it's way format of data is. if delete field class, should change serialversionuuid or consumers of object may read incorrectly. check out a

d3.js - Disable interactivity in dc.js -

i have number of bar charts created using dc.js . in default behavior, user can click+drag on of them update crossfilter. how can make chart "display-only"? is, chart update when other components update crossfilter, user can't select data in "display-only" chart update crossfilter.

mysql - Storing xbee source addr into database in Python -

i have raspberry pi connected xbees , motion sensor, receiving data motion sensor connected 1 of xbee. send data raspberry pi. there way manipulate or split output such status being true/false , address =\x00\x13\xa2\x00@\xbbj wanted store address database if status=="true". so if if status[0]['dio-0'] == true : print "yes" cur = con.cursor() cur.execute("insert ignore sensor(sensor_id, status) values(%s,true)",(add[0])) con.commit() but address stored database weird characters instead of \x00\x13\xa2\x00@\xbbj. or should other ways? this codes. from xbee import xbee import serial port = '/dev/ttyusbxbee' baud_rate = 9600 # open serial port ser = serial.serial(port, baud_rate) # create api object xbee = xbee(ser) def decodereceivedframe(response): add = str(response['source_addr_long']) status = response['samples'] return [add, status]

Tracking Changes made to hyperlink fields ms access -

i using code below audit changes made subform. when code run hits object , receive error says "operation not supported type of object". assume due fact 1 of fields checking hyperlink. should work hyperlinks? , if not, there way keep hyperlink without having convert text , still checked? not believe entirely important keep hyperlink since field contains email addresses made sense have hyperlink. edit turns out more hyperlink field causing issue. have gone through debugger unsure 1 raising issue. loops through @ least 5 times before error raised. to give credit credit due, following code had similar question asked. access 2010 audit trail on subforms any or workaround appreciated. option compare database option explicit sub auditchanges(idfield string, useraction string) on error goto auditchanges_err dim cnn adodb.connection dim rst adodb.recordset dim ctl control dim dattimecheck date dim struserid string 'added code dim subformname string set cnn = curr

node.js - Looping through Mongoose results returns undefined -

i have 2 mongodb collections , have defined schemas in mongoose. file.fileschema file name eg. "whatever.txt" , (filecatschema.path) path eg. "c:/text/". var fileschema = new schema({ name : string, file : string, cat_id : [{ type: objectid, ref: 'filecategories' }] }); var filecatschema = new schema({ branch : string, file : string, path : string }); in api have populated files file categories (filecatschema) , want return full path on request /api/files/ when try access properties inside populated json data gets returned undefined. can explain happening here? going through same process in different environment e.g. chrome's console gives me data want. api.get('/files/', function(req, res) { apimodel.files .find({}) .populate('cat_id') .exec(function(err, data) { for(var i=0; < data.length; i++){ if(data[i].file){ console.log(data[i].cat_id) /*this returns array data wa

osx - Using the OpenSSL libraries built from source in an OS X app -

my os x app uses openssl libraries, both libssl , libcrypto libraries. specific version of openssl libraries has been using 1 provided in os x, namely /usr/lib/libssl.dylib , /usr/lib/libcrypto.dylib , @ version openssl 0.9.8zg, , app has been working fine. since want use tls 1.2 in app, , openssl libraries provided in os x, @ version openssl 0.9.8zg, not support it, want use openssl libraries @ version openssl 1.0.2d, available in source @ openssl site, in app. toward goal of upgrading openssl libraries in app version openssl 1.0.2d, built openssl libraries source , compiled app them successfully. however, resulting app didn't function properly, , don't know why. running resulting app, ssl_connect() returned error, , subsequent call ssl_get_error() returned ssl_error_ssl. case libraries being dynamic libraries or static libraries. more strangely, got same result when used openssl 0.9.8zg libraries built source in building app. anyone have solution or explanation pr

c - How to make the pyramid (CS50 Mario Program) formed by this code to be right aligned? -

please me create pyramid height "n" print correctly using hashes , spaces right-aligned. have posted code below. program correctly asks user input, doesn't build pyramid right-aligned. if can fix this, please help. #include <stdio.h> #include <cs50.h> int main(void) { int i=0; int n=0; { printf("height:"); n=getint(); } while (n<0 || n>23); (i=0; i<n; i++) { printf(" "); (int x=0; x<i+2; x++) { printf("#"); } printf("\n"); } return 0; } inside main loop have: // instruction printing 1 space // sub loop printing x+1 number of hashes // instruction printing new line so each time loops round it's correctly drawing hashes , new line not telling draw more 1 space each time unlike subloop hashes instruction doesn't increase each pass.

Javascript confirm window wont go away -

i can't seem find answer where, feel might browser specific (i'm using chrome). how come when click cancel on confirm window keeps popping right up? <script> $(document).ready(function() { $('.postdelete').click(function () { var c = confirm("please confirm post deletion"); if (c == true) { var post = $(event.target).closest('.post'); var postid = post.find('.postid').html(); //send postid deletepost.cshtml execute sql delete command $.ajax({ url: '../deletepost.cshtml', type: 'get', data: { selectedpostid: postid }, success: function (result) { window.location.replace(window.location.href); console.log("result: " + result); } }); } else { console.log('canceled');} }); }); </script> since not code causing problem must in html here is: _layout.cs

validation - PHP: How to add more parameters to filter_var() to match also specific domains? -

i have html form email field want validate. i'm processing form php, used filter_var() function. the thing also want filter emails not contain 3 specific domains after @ sign (like email inserted should filtered if not legal, , if not @example.com , @example2.com or @example3.com ). how may that?: <?php if (!filter_var($_post['emailremitente'], filter_validate_email)) { echo "<br>oops! not valid email"; } else { ... // array of domains rejected - domains must lower case $rejecteddomains = array('yahoo.com', 'hotmail.com', 'gmail.com'); // break email address (assuming have validated email already) $emailparts = explode('@',$_post['emailremitente']); // check if second element (the domain) in $rejecteddomains if (in_array(strtolower($emailparts[1]), $rejecteddomains)) { // rejected domain } else{ // accepted domain }

Ending session when Logging out in JSP -

Image
following navigation bar include logout button page. i want end session when user click logout button. i found sample codes googling , added code following code shows error.(check error in screenshot) <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">hi, <%=session.getvalue("username") %><b class="caret"></b></a> <ul class="dropdown-menu"> <li align="center" class="well"> <a href="index.jsp" class="btn btn-sm btn-default"><span class="glyphicon glyphicon-log-out"></span> logout</a> <% session.invalidate(); response.sendredir

bash - moving files in subdirectories up one (and *only* one) level -

i trying move files nested in subdirectories 1 level. in os x terminal, , new bash. i'm simple, don't know how it. i want change file structure looks this: ~/container /1-a level 1 - 000.jpg level 1 - 001.jpg level 1 - 002.jpg /1-b /2-a level 2 - 007.jpg level 2 - 008.jpg level 2 - 009.jpg /1-c level 1 - 003.jpg level 1 - 004.jpg level 1 - 005.jpg level 1 - 006.jpg /1-d /2-c level 2 - 010.jpg level 2 - 011.jpg level 2 - 012.jpg level 2 - 013.jpg level 2 - 014.jpg /1-e level 1 - 015.jpg level 1 - 016.jpg level 1 - 017.jpg /1-f /2-b /3-a level 3 - 018.jpg level 3 - 019.jpg level 3 - 020.jpg

email - javax.mail.AuthenticationFailedException Java Mail -

Image
i have made little program send message email account. of code seems work fine. however, have encounter authenticationfailedexception when code hit transport.send in program. not sure why because think have set correctly. here code. javaemail.java public static void main (string[] args) throws exception{ //intialize logger protected static logger logger = logmanager.getlogger(javaemail.class.getname()); //smtp related parameters private static string smtpuseremail; private static string smtpreceiveremailaddress; private static string smtpuserpassword; private static string smtpportnumber; private static string smtphost; private static string emailsubject; //stack error message variable private static string message; try { logger.info("-----------------------------"); logger.info("---------starting up---------"); logger.info("-----------------------------"); initializ

android - Self Signed Certificate - Trust anchor not found -

edit: bnk in comments has linked solution found here . i'm sending off post requests via rest backend server (over lan), done on https. server has self signed certificate .pem file, works okay. i'm trying connect different web server (over wan, through dns), self signed certificate .crt file (standard, ber/der format). now, although code same, receiving following exception: java.security.cert.certpathvalidatorexception: trust anchor certification path not found. i'm not sure why 1 server okay connect other not. not want trust certificates going on public internet. my network code: public httpsurlconnection setuphttpsconnection(string urlstring) { try { // load cas inputstream certificatefactory cf = certificatefactory.getinstance("x.509"); inputstream cainput = new bufferedinputstream(context.getassets().open("server.crt")); certificate ca = cf.generatecertificate(cainput); system.out.prin

javascript - Check all with specific value in checkbox using jquery -

i got problem when want develope checkall function using jquery. i put checkboxes in table make clear , check checkbox value in input . for example, when click checkbox value type1 , checkboxes value including type1 checked (type1, type1-1 , type 1-2). html: <table> <tr class='type1'> <td><input type="checkbox" value="type1"></td> <td>type_1<td> </tr> <tr class='type1-1'> <td><input type="checkbox" value="type1-1"></td> <td>type_1-1<td> </tr> <tr class='type1-2'> <td><input type="checkbox" value="type1-2"></td> <td>type_1-2<td> </tr> <tr class='type2'> <td><input type="checkbox" value="type2"></td> <td>type_2<td> </t

asp.net - Form Filling Pdf Check box appear in IE is unchecked and in Chrome or firefox it appear as checked ? Using itextSharp in C# -

i using itextsharp form filling of pdf using asp.net c#. have identified check box value check using fields.getappearancestates("pt1line2_unit[0]") the code used check is fields.setfield("pt1line3_male[0]", "y") i have tried fields.setfield("pt1line3_male[0]", "y", "y") it appear checked in chrome , firefox issue in ie. know ie use installed pdf software (adobe reader xl) in adobe reader xl same issue. abobe version 11.0.09 issue few check boxes , remaining getting expected only. can please solve issue.

exchangewebservices - Error while sending Email :you must load or assign this property before you can read its value -EWS -

i error in message.body.bodytype while sending email: must load or assign property before can read value if (service != null) { microsoft.exchange.webservices.data.emailmessage message = new microsoft.exchange.webservices.data.emailmessage(service); message.subject = sendmail.subject; if (sendmail.ishtml) { message.body.bodytype = microsoft.exchange.webservices.data.bodytype.html; message.body = new microsoft.exchange.webservices.data.messagebody(sendmail.html); } } you should using bodytype parameter in messagebody overload set bodytype eg if (service != null) { microsoft.exchange.webservices.data.emailmessage message = new microsoft.exchange.webservices.data.emailmessage(service); message.subject = sendmail.subject; if (sendmail.ishtml) { message.body = new microsoft.exchange.webservices.data.messagebody(microsoft.exchange.webservices.data.bodytype.html,sendmail.html);

android - Snackbar is not working within fragment class -

i trying show snackbar view when click on button shows force close error when click on button i have define fragment class below , error log. i have fragment class: public class homefragment extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_home, container, false); context = getactivity(); initui(rootview); return rootview; } private void initui(view view) { btn= (button) view.findviewbyid(r.id.btnpress); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { snackbar.make(getview(),"snackbar test" , snackbar.length_long).show(); } }); } fragment_home.xml : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:

xslt - Removing xsi:nil="true" from payload from outbound messages in Maximo -

i new xslt , remove "xsi:nil="true"" attributes created tag in payload generated maximo. <routestopid xsi:nil="true" /> <schedfinish xsi:nil="true" /> <schedstart xsi:nil="true" /> could please suggest how achieve using xslt. thanks in advance. remove "xsi:nil="true"" attributes created tag if that's all styleheet supposed do, make it: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:strip-space elements="*"/> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:te

Mongodb count all array elements in all objects matching by criteria -

i have collection log of activity on objects this: { "_id" : objectid("55e3fd1d7cb5ac9a458b4567"), "object_id" : "1", "activity" : [ { "action" : "test_action", "time" : isodate("2015-08-31t00:00:00.000z") }, { "action" : "test_action", "time" : isodate("2015-08-31t00:00:22.000z") } ] } { "_id" : objectid("55e3fd127cb5ac77478b4567"), "object_id" : "2", "activity" : [ { "action" : "test_action", "time" : isodate("2015-08-31t00:00:00.000z") } ] } { "_id" : objectid("55e3fd0f7cb5ac9f458b4567"), "object_id" : "1", "activity" : [ { &q

flash - MF Notepad conversion -

someone assign me task type document in mf notepad software (adobe flash player mf notepad). after typing have save document. can see file not have extension. issue software not allow paste feature have type words, time consuming process. so if can know in extension mf notepad save file if software available in market can directly convert word mf notepad extension fast me. according view should convert in flash file when convert word flash using other software , try import/load mf notepad show me garbage character (like box...)

linux - How to open a .sess file? -

i have session files of extension *.sess . how open on linux/windows? tried using normal text editors partial junk values , partial actual text. thanks! i hope trying read php session files. if so, please go through below link reading session files using simple php code: read session data session storage file

php - Replace all the first character of words in a string using preg_replace() -

i have string this sample text. text used dummy "various" regex "operations" using php. i want select , replace first alphabet of each word (in example : t,i,a,s,t,t,t,w,b,u,a,d,f,",r,",u,p ). how do it? i tried /\b.{1}\w+\b/ . read expression "select character has length of 1 followed word of length" didn't work. you may try regex well: (?<=\s|^)([a-za-z"]) demo

java - Change the width of JTable column -

i need change column width size of jtable . please @ following code use display values. don't know how maximize width of table column. please let me know how configure code. public void displaytable(jtable table){ vector columns = new vector(getindividual(0).chromosomecolumncount()+1); columns.add("staff names"); for(int i=0; i<getindividual(0).chromosomecolumncount(); i++){ columns.add(rostermanager.getday(i)); } vector data = new vector(); vector row; for(int row1=0; row1<getindividual(0).chromosomerowsize(); row1++){ row = new vector(getindividual(0).chromosomecolumncount()); row.add(rostermanager.getnurse(row1).getempname()); for(int col=0; col<getindividual(0).chromosomecolumncount(); col++){ row.add(getindividual(0).getshift(row1, col).getshiftname()); } data.add(row); } defaulttablemodel