Posts

Showing posts from March, 2010

server - how to make a browser application,android application and ios application in a single stretch -

can suggest me how make hybrid app using ionic , backend mongodb , server node running node in server automatically stated ionic front end page , works fine in browser but while running ionic serve --lab not connecting server i implemented browser application using above while making .apk file not able connect server can 1 suggest solution this hi found solution done server using rest api , front end ionic connecting rest api

Preventing Users from Seeing Old Data MySQL/iOS -

i'm using app allows users upload , download pics. similar snapchat can view pics of follow. after 24 hrs these pics moved archive table users no longer able see them. i'm accomplishing aspect mysql partitions. however, on client side need continuously update mysql query date of last gotten row photos table. store date on ios app. becomes problematic if users logs out , allows else log in. have clear data , have not reference point either user now. i have solution around , want know how feasible is. create trigger run each time user retrieved photos. update column on users table hold last date viewed. way when user logs in have reference last date viewed. idea? i'm open suggestions on how better approach seeing how need save pictures instead of deleting them. *note partitions work because need ensure photos last minimum of 24 hrs photos end lasting more 24hrs providing possibility users can still see photos photos table *id: binary 16 *users_id: foreign: bin

hadoop - Kafka on Windows - start service error -

i trying cleanly start kafka 2.10 - 0.8.2.1 on windows getting annoying error everytime start it. i have installed kafka following quick start guide (with exception have installed zookeeper myself). both kafka , zookeeper installed basic, on single machine. problem when run starting script: kafka-server-start.bat c:\kafka_2.10-0.8.2.1\config\server.properties i error: error [2015-07-14 17:00:45,197] warn error when freeing index buffer (kafka.log.offsetindex) java.lang.nullpointerexception @ kafka.log.offsetindex.kafka$log$offsetindex$$forceunmap(offsetindex.scala:301) @ kafka.log.offsetindex$$anonfun$resize$1.apply(offsetindex.scala:283) @ kafka.log.offsetindex$$anonfun$resize$1.apply(offsetindex.scala:276) @ kafka.utils.utils$.inlock(utils.scala:535) @ kafka.log.offsetindex.resize(offsetindex.scala:276) @ kafka.log.log.loadsegments(log.scala:179) @ kafka.log.log.<init>(log.scala:67) @ kafka.

openerp - Populating dropdown list according to product id in Odoo -

i have created tab in product form manufacturer. has manufacturer_name , manufacturer_partno fields , others. each product has multiple manufacturers (one many relationship). want dropdown of manufacturer_partno in add supplier form of same product (same product id). want know how possible. please me out if can. // product class extension class product_template(osv.osv): _inherit = "product.template" _columns = { 'mrpproduct_partnumber': fields.char("part number", size=30, required=true), 'mrpproduct_description': fields.text("description", required=true), 'mrpmanufacturers_ids': fields.one2many('mrpproduct.manufacturer','mrpproduct_id',string="manufacturers"), 'mrprohs_compliant': fields.boolean('rohs compliant'), 'mrprequires_inspection': fields.boolean('requires inspection'), 'mrpperishable': fie

Running same job in Parallel using Jenkins and build flow -

i trying run same automated job (deriv_client_add) in parallel different parameters: parallel( {build("gui/deriv_client_add", branch:params.branch, config:params.conf)} ) if run job multiple times different branch , config queues them up. there way run same job multiple times in parallel? thank ;) try below plugin suit requirement checkthis

R tolower function -

how convert data frame lower case if use tolower(df) , workspace crashes.x ps: df has around 400000 rows , 4 columns , need text inside df in lowercase try: x<- apply(x,2,tolower) this works smaller dataframes. might have chunk yours , rebind them many rows though.

java - OnClickListener doesn't work implicitly. Why? -

i created custom button class implements listener interface: public class blinkbutton extends button implements view.onclicklistener { list<onclicklistener> onclicklistenerlist = new arraylist<onclicklistener>(); public blinkbutton(context context) { super(context); this.setlistener(new highlightbuttonlistener()); } //other constructors here public void setlistener(onclicklistener listener){ onclicklistenerlist.add(listener); } @override public void onclick(view v) { for(onclicklistener listener : onclicklistenerlist){ listener.onclick(this); } } and have view: <com.example.element.blinkbutton .../> i claim onclick method inside com.example.element.blinkbutton should call implicitly when user clicks blinkbutton, it's not. have write explicitly: android:onclick="fireevent" , public void fireevent(view view) { fireeventbutton.onclick(view); } why blinkbutton.onclick(); doesn'

objective c - Attaching a sheet the first time -

Image
i'm writing application needs read data off smartcard. due way smartcards work, operation take few seconds during time updates display it's read far, isn't going responsive yet until everything's read; so, avoid confusion, want show sheet spinner , text "reading data card..." user knows what's going on. in xib, i've created new window containing spinner , nstextfield. when try show sheet, following: [[nsoperationqueue mainqueue] addoperationwithblock:^{ [_spinner startanimation:self]; [nsapp beginsheet:_cardreadsheet modalforwindow:_window modaldelegate:self didendselector:@selector(endsheet:returncode:contextinfo:) contextinfo:nil]; }]; and later on, when state machine indicates we've finished reading, do: [[nsoperationqueue mainqueue] addoperationwithblock:^{ [nsapp endsheet:_cardreadsheet]; [_spinner stopanimation:self]; }]; there a - (void) endsheet:(nswindow*)sheet returncode:(nsinteger)returncode co

html - Div still has height:0px -

i have div has content still has height:0px; , in example can see "index-slideshow" has height:0px; , need "position:absolute;" because photos must 1 above other jquery slideshow. this div has contents hasn't height. what's problem? jsfiddle demo #index-slideshow { margin: 0px; position: relative; width: 100%; padding: 0px; max-width: 100%; box-sizing: border-box; z-index: -1; } #index-slideshow > img { position: absolute; top: 0px; left: 0px; width: 100%; max-width: 100%; margin: auto; box-sizing: border-box; } .wrap { margin: 0 auto; width: 950px; max-width: 93%; border: 0px; padding: 0px 10px 10px 10px; background-color: blue; color: white; } <div id="index-slideshow"> <img src="http://lorempixel.com/400/200"> <img src="http://lorempixel.com/g/400/200"> </div> <div class="wrap"> <p>l

c# - ASP.NET MVC How to use PartialView in Layout? -

i need render menu in layout using partial view (if there better approach, please let me know). i'm doing way (in layout): @if (user.isinrole("admin")) { @html.partial("adminmenu") } and how call in controller: public actionresult adminmenu() { var = _amr.getadminmenu(); return partialview(am); } so here partial view: @model ienumerable<digitalhubonlinestore.viewmodels.adminmenuviewmodel> <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownmenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> admin menu <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdownmenu1"> @foreach (var item in model) { <li><a href="@html.

html - Probelm with padding within in a div -

Image
i can't figure out: have div centered on screen width of 60%. inside div have 3 more divs float left width of 33% , have gray bg color. divs filled text , 1 image per div. each div should take 1/3 space inside "maindiv". works fine give 3 "contentdivs" padding text gets seperated bit third div wanders below others. want margin around 3 divs there gap between divs. works if give divs width of 31%. shrink browser though, third 1 pops below others again. how looks now: how looks width of 33.33% how can fix this? mean set divs relative width setting size in %. divs should shrink shrink browser window. tried surround divs other divs , messed around margins , paddings wont work. any appreciated :) most it’s box model’s fault. paddings, margins , borders can added in different ways. add box-sizing:border-box container , elements. brings intended do, , width:33.3333% wil work out expected. adding margin still breaks item? there’s great thing c

python - How to fit SGDRegressor with two numpy arrays? -

i'm trying learn sgdregressor . generate own data don't know how fit algorithm. error. x = np.random.randint(100, size=1000) y = x * 0.10 clf = linear_model.sgdregressor() clf.fit(x, y, coef_init=0, intercept_init=0) found arrays inconsistent numbers of samples: [ 1 1000] i'm new python , machine learning. miss? >>> np.random.randint(100, size=1000) will give 1 x 1000 array. features , target variables need in column. try >>> x = x.reshape(1000,)

Xpages document changing document mode? -

i have strange thing occurring; usual, can't post code, unfortunately, i'm describing problem in case can suggest possible cause. i have xpage custom control included on it; custom control handles document locking , changing edit/read-only modes via links. document locking done setting applicationscope variable based on unid. make more friendly other users on system, run function periodically on page check whether document locked or not , update link/label/tooltips appropriately (e.g. if locked user, "edit" button disabled; when lock released, it's re-enabled). done calling "xagent" through standard, simple dojo-based ajax call. for reason, behavior of system gets erratic after 45 seconds minute. i'm checking lock status every ten seconds or so, it's not happening first call. i'm displaying list of records associated document; each record row in repeat. when first go edit mode, controls displayed should be, i.e. editable. if us

Generating a PDF with Prawn and Ruby On Rails -

i've been following ryan bate's railscast tutorial (excellent always) have run issue cannot seem resolve. i have prawn::document rendering using static content fine, ie with class printpdf < prawn::document def initialize super text "text" end end and in controller def print @vegetaux = vegetable.all respond_to |format| format.html format.pdf pdf = printpdf.new send_data pdf.render, filename: "vegetaux.pdf", type: "application/pdf", disposition: "inline" end end end but when try pass in rails model adding this pdf = printpdf.new(@vegetaux) & in pdf object class printpdf < prawn::document def initialize(vegetaux) super @vegetaux = vegetaux text "text" end end i error message no implicit conversion of symbol integer relating line... pdf = printpdf.new(@vegetaux) the object @vegetaux seems ok though, because in html reponse can loop t

c# - How to share session between a MVC project and a WCF project? -

i have angular-webapi-mvc-wcf solution. i want share user session between mvc , wcf projects. possible? also, want share authentication mechanism, mean, want user authenticated once on mvc project using formauthentication, , let wcf know when user authenticated without envolving other technologie. i have solution mvc , wcf app reside on same project(dll), , on context can share authentication , session data. so, in order share session, should move svc files wcf mvc project? way? all projects share same db, solve without having store session data on db level. thanks info if wcf layer on same app pool, can check aspxauth cookie (forms auth cookie name configurable) , can use methods in formsauthentication class/namespace decode cookie user in wcf layer. if configure forms auth cookie domain cookie can host wcf layer in different app pool/iis site long it's on same domain main site. both sites receive cookie. that cookie drives forms authentication. if fo

Postgresql - Table size do not refresh -

i want know size of table (postgresql). make query: select pg_size_pretty(pg_table_size('mytable')); result: 8192 bytes then, add 4 rows , result same (8192 bytes). what doing wrong? missing? thanks lot... postgres puts records in fixed-size pages , 8kb each default. storage allocated 1 page @ time. once add enough rows reach table's fillfactor , add second block, , size jump 16384 bytes.

ruby on rails - Syntax Error in application.yml File -

i running command rail s , displays following error: /home/user/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:189:in `missing_key': missing setting 'mail_from' in /home/user/myapp/my_app/config/application.yml (settingslogic::missingsetting) what wrong in application.yml? my config/application.yml defaults: &defaults site_name: site host: site url: site resque: server: 127.0.0.1:6379 namespace: resque_namespace smtp: domain: domain login: login password: secret server: host port: 25 mail_from: mail@example.com robokassa: login: login test_mode: false pass1: secret pass2: secret token: secret avisosms: login: login service_id: 666 hash: secret sdpays: md5: secret project_id: 666 edit_delay: 5 contest_id: 1 aws: ses: access_key_id: secret secre

php - Magento - Admin URL Shows Front End 404 (Csutom Module) -

i creating magento module allow products reported. have done front end okay , working there. i have come create admin area module , having lot of trouble. when click on menu item module (catalog > reported products), renders front end of website. (the url expected though "domain.com/index.php/admin/reported_products/adminhtml/key/76f4724a69.../"). displays 404 page. i've tried lot of variations on action of menu item nothing has worked. i've changed front_name under admin node, nothing :/ i'll try present files in nice order... app/code/local/tbe/report/etc/config.xml <modules> <tbe_report> <version>0.1.0</version> </tbe_report> </modules> <global> <helpers> <report> <class>tbe_report_helper</class> </report> </helpers> <blocks> <report> <class>tbe_report_block</class

html - Prepopulated SMS text getting truncated after certain character(s). -

my mobile site uses simple html tag enable user call mobile's sms app mobile browser: <a href="sms:1234567?body=hello world">send sms</a> this prepopulates body of messages 'hello world' , phone number field '1234567'. but i've noticed if body contains # , text beyond # gets truncated. instance if text <a href="sms:1234567?body=hello #world">send sms</a> only 'hello' prepopulates in body of text. can shed light on why happens, , whether there's way circumvent this? thanks. as per alex k's response in comments, needed apply url encoding. i'm writing django app, in case, did following: <a href="sms:+92123?body={{ description|urlencode }}">sms</a>

javascript - Creating a textbox with predefined data -

i facing problem in creating text box email address want filled example: @hotmail.com actual identifier entered user, want in single text box. possible? remember have seen somewhere on websites. this kind of approach may fulfill need $('button').on('click',function(){ var name = $('#in').val(); var domain = $('#dom').val(); alert(name + domain); }); #in{ border-right:0px; margin-right:0px; padding-right:0px; } #dom{ border-left:0px; margin-left:-5px; padding-left:0px; text-align:right; width:108px } input{ border:1px solid black; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input id="in"/> <input id="dom" readonly value="@example.com"/> <button>subscribe</button> <p></p>

slider - How refresh Flickity plugin? -

i have problem flickity plugin. want use 1 mixed svgloader plugin. slider animation does't work correctly because need resize window refresh flickity plugin. can try here : http://thibaut-lalanne.com/ thx you can manually refresh slider anytime. yourflickityslider.resize();

Android BLE characteristic read/Write failed in Lollipop but worked in Kitkat -

as per title able read/write data in below lollipop in lollipop many times getting read/write fails. this how doing read/write data: boolean isread= getmbluetoothgatt().readcharacteristic(characteristic); in lollipop devices getting isread false many times works on non lollipop os. does 1 has faced such problem ? answer appreciated. thanks. one of reasons of api calls defined in android kitkat (apilevel 19) have been deprecated in lollipop versions(api level 22) updated , additional features.you can go through developer portal https://developer.android.com/about/versions/android-5.0.html#wireless know more.

android - How to filter list view using search edittext with JSON url -

am using edittext search form json url datas, give search field. search each letter type on edittext filter listview , @ same time listview reload, if edittext empty show current list. how please me... @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.electronic_main); search = (edittext) findviewbyid(r.id.text_search); listview = (listview) findviewbyid(r.id.listview); search.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { arraylist<hashmap<string, string>> arraytemplist = new arraylist<hashmap<string, string>>(); string searchstring = search.gettext().tostring().tolowercase(locale.getdefault()); listview.sett

Disappeared widget bar in the admin panel (Wordpress) -

witam, welcome, the widget bar disappeared in admin panel (wordpress), despite fact visible on page. how back? i enclose 2 screens, first ok, second error: regards, d4rq000z

c# - How to use a lambda expression to return Collection -

given below error throwing type casting error public collection<assignedreadingscheduledto> getassignedreadingschedulelist(int substationid, datetime getlastsyncdate, out string errormessage) { assignedreadingscheduledto filter = new assignedreadingscheduledto(); collection<assignedreadingscheduledto> colasgnreadschedullist = null; messageserviceclass messageservice = new messageserviceclass(); exceptioncodedto errormessagecode = null; errormessage = string.empty; assignedreadingschedule_ida daasgnreadingschedulelist = (new assignedreadingscheduleda()).createdbobject(); try { filter.localcntrid = substationid; filter.stationtype = 2; colasgnreadschedullist = new collection<assignedreadingscheduledto>(); colasgnreadschedullist = daasgnreadingschedulelist.getassignedreadingschedulelist(0, int32.maxvalue, filter, out errormessagecode).where(x=>x.updateon >= getlastsyncdate) collection<assignedread

Matlab: Find points within a certain range in an array and their order/location in the array? -

i've array x = 10 5 (e) 20 5 30 6 40 4 50 3 60 8 70 12 and on... i know value 5 i've called e. know located in array. want following: all elements in x(2:2:end) within range of +/-3 e. (which 5, 5, 6, 4, 3, 8). the corresponding x(1:2:end) values found within range. means final answer y should be: y = 10 5 20 5 30 6 40 4 50 3 60 8 thanks lot! in matlab/octave, can find indexes of non-zero elements function find . problem solved combining find logic operators: y = x(find(x <= x(2)+3 & x >= x(2)-3)); explained: e = x(2) x <= e+3 % produces matrix element-wise result (1 or 0). x >= e-3 % values determined logic operators >= , <=. find(x) % returns matrix indeces of non-zero elements of x. x(find(x)) % returns non-zero elements. tested in octave (though should work in matlab too).

sql - HSQLDB update field of one table from field of another one -

trying this: update table1 t1 set cost = t2.price table2 t2 t1.item_id = t2.item_id it's working on postgresql not working on hsqldb. how fix script support working both on postgresql , hsqldb? hsqldb not support update ... from statements. on hsqldb use merge statement instead. out of head, hoping not contain syntax errors: merge table1 using table2 on table1.item_id = table2.item_id when matched update set table1.cost = table2.price unfortunately, of today postgres not seem support merge statement , similar upsert.

r - Rename function for data frame columns -

i trying make function gets input data frame , 2 names (old , new) , replaces column old name of data frame new name. tried df <- data.frame(a = 1:3, b = 8:10) my.rename <- function(df, old.name, new.name){ names(df)[names(df) == old.name] <- new.name } my.rename(df, "a", "something") df and my.rename <- function(df, old.name, new.name){ eval(substitute(names(df)[names(df) == old.name] <- new.name), df) } my.rename(df, "a", "something") df but name doesn't seem affected. you need return dataframe modifed in function: df <- data.frame(a = 1:3, b = 8:10) my.rename <- function(df, old.name, new.name){ names(df)[names(df) == old.name] <- new.name df } df2 <- my.rename(df, "a", "something") df2

string - How to change the dot (if more than 2) in java? -

i'd change dot "" if more 2. mean hel.lo.txt or he.l.l.o.txt returns hello.txt . i wrote not begin end "." int pointindex = filename.indexof("."); if (pointindex==0){ system.out.println("point index :"+pointindex); string mystring=filename.substring(pointindex, 1); filename=filename.replace(mystring, ""); } //end "." int extensions = filename.lastindexof("."); string newfilename=filename.substring(extensions); system.out.println(newfilename.length()); if ( newfilename.length()<2){ system.out.println("dont have extension, filename end is"+"."); int dotidx=filename.lastindexof("."); filename=filename.substring(0,dotidx); system.out.println(filename); } you can manipulate string here string str = "he.l.l.o.txt"; int lastindexofdot = str.lastindexof('.'); string str1 = str.substring(0, lastindexofdot + 1); str

android - Align ImageView to right of it`s parent layout which is LinearLayout -

Image
i want align imageview right(end) side of it`s parent layout, compulsory linearlayout. not recommended use relativelayout anywhere. shown in below image, highlighted image should right side of screen. , without using relativelayout. in advance. below activity_main.xml code <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightsum="4" tools:context="com.pinchzoom.pinchzoomexampletwo.mainactivity" > <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.5" android:gravity="center_vertical" android:orientation="horizontal" > <ima

java - How to refresh TableView after deleting data from it? -

how refresh tableview after deleting data ? (i have click on row , on deletebutton, delete) here delete data form observable-list: @fxml void delaction(actionevent event) { fnldata.remove(index); //fnl data observable list finaltable.getselectionmodel().clearselection(); //finaltable ist tableview } public final void select() { finaltable.getselectionmodel().selecteditemproperty().addlistener(new changelistener() { @override public void changed(observablevalue observable, object oldvalue, object newvalue) { setindex(fnldata.indexof(newvalue)); system.out.println("ok"); } }); } ok fixed it... here code: @fxml void delaction(actionevent event) { fnldata.remove(index); finaltable.getselectionmodel().clearselection(); finaltable.getitems().clear(); finaltable.getitems().addall(fnldata);

php - Require One Post per Category in Wordpress -

i have created website in wordpress... , requirement need 1 post per category on homepage.. below code in php: $args = array('type' => 'post', 'orderby' => 'name', 'order' => 'asc', 'number' => '10', 'taxonomy' => 'category'); $categories = get_categories($args); foreach($categories $category) { $catquery = new wp_query( 'cat='.$category->cat_id.'&order=desc' ); while($catquery->have_posts()) : $catquery->the_post(); echo "some div & links"; endwhile; } the above code give me post in category... how 1 latest post per category..?? wat should change in above code..??? please let me know... i have resolved issue.. please check below code $args = array('type' => 'post', 'orderby' => 'name', 'order' => 'asc', 'number' => '10', '

r - custom metric using ROCR package in caret -

here minimal example of problem. want use recall performance metric in caret library(caret) set.seed(1234) x <- matrix(rnorm(10),nrow=5,ncol=2 ) y <- factor(c("y","n","y","y","n")) my.metric <- function (data, lev = null, model = null) { out <- rocr::performance(rocr::prediction(data$pred, as.numeric(data$obs)-1,"rec")) names(out) <- "rec" out } mycontrol <- traincontrol(summaryfunction = my.metric, method="repeatedcv", number=10, repeats=2) fit <- train(y=y,x=x, metric = "rec",method="gbm", trcontrol = mycontrol) however, error error in rocr::prediction(data$pred, as.numeric(data$obs) - 1, "rec") : format of predictions invalid. i haven't used package in while based on example in ?prediction , need pass class probabilities (and train doesn't generate these unless use o

jquery - alert the value of an element on click of link Ajax -

how can alert value of element onclick of link here? simple alert not working inside , don't want use console.log() var row = ''; $.each(result, function(index, element) { row += '<tr>'; row += '<td>' + '<a href="" onclick="alert value here(alert(element.name)">' + "link" + '</a>' + '</td>'; }); save value in "data" element in link , later use value @ runtime when make click: example on fiddle var row = ''; $.each(result, function(index, element) { row+='<tr>'; row += '<td>' + '<a data-name=' + element.name+ ' href="" onclick="alert($(this).data(name));">' + "link" + '</a>' + '</td>'; });

memory - How can I compute the differences of 2 unsigned char arrays? -

i have 2 unsigned char arrays , lengths. , these arrays have "null" char in content. how can find out different, diff function in svn? want list of differences, including content delete or insert or equal. memcmp returns equal or not. not option. string diff libraries not suitable, because there '\0' chars in arrays. after googling lot , trying lot, achieved goal using libmba .

algorithm - How to find all combinations of multiple 2D arrays(matrix) , rotation allowed -

Image
i have 3 2d arrays(matrix) 0 , 1- for each array, rotate 4 times clock-wise , 4 times anti clock-wise , flip array , repeat above , each iteration repeat steps other array , on combine array build symmetry or kind of rubik's cube 5 elements each side. means if add 2 arrays , means 1 of array 1 must fit 0 of array 2. following kind of structure- following 3 arrays 0 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 1 ------------- 0 1 0 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 ------------- 1 0 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 ------------- this problem evolved problem asked how solve 5 * 5 cube in efficient easy way . consider rotate methods follows - rotateleft() rotateright() flipside() (firstarray){ element = single.rotateleft(); for(secondarray){ element2 = single.rotateleft(); if(element.combine(element2){ for(thirdarray){ } } } } currently have fixed 3 arrays , how , efficiently must solve problem.

vb.net - Open and Close App with VB .NET -

i have 1 project in vb.net , project have function open , close program calculator. have opened calc.exe code this: private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click shell("c:\windows\system32\calc.exe") end sub but when try create function close program dont't know how write code. function useful closing programs have been opened button1. anyone can me make function close program? instead of shell can use process dim p process = process.start("c:\windows\system32\calc.exe") threading.thread.sleep(10000) ' terminate after 10 seconds p.kill() if need trigger killing process somewhere needs access process handle p. or if want kill old process have not started need process.getprocessesbyname() give array of process can lop through , kill relevant one. here example dim myprocesses() process dim myprocess process myprocesses = process.getprocessesbyname("name

What's the better way to optimise video file size in android programmatically? -

i want reduce size of video file less 25mb. there way achieve without using third party library? you can mp4parser library. have @ shortenexample name suggests. since library cannot re-encode video can cut video @ i-frames. points in time can make cut quite coarse. on android 4.1 can access hardware codecs via mediacodec api option (but haven't seen example of yet) or, can use class: trimvideoutils.java source: https://stackoverflow.com/a/11551682/1796309

php - json for displaying youtube video description and view count is not working after a youtube update -

i have facebook wall, in project, when user posts youtube link, displayed in facebook wall. first image , description , views. code used work sucessfully, after update @ youtube, there bugs, image displayed sucessfully not title, description , views. ideas how fix this? code getting title, video description , views count: <?php $find_youtube = "://www.youtube.com/"; if(preg_match('~msie|internet explorer~i', $_server['http_user_agent'])) { if(preg_match("[$find_youtube]", $row['comment'])){ parse_str( parse_url( $row['comment'], php_url_query ), $my_array_of_vars ); $regex='#(?<=v=)[a-za-z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n ]+#'; preg_match($regex, $row['comment'], $mid); $id = $mid[0]; $json_output = file_get_contents("http://gdata.youtube.com/feeds/api/videos/{$id}?v=2&alt=json"); $json = json_decode($json_output, true); $video_title = $json[&#

android bluetooth - How to Send an Audio HEX file to Ble Device -

i have working ble device android . sends , receives data finely through android app. problem want send audio hex files ble device. , larger 20 bytes. how can send such data ble device. ?? for send data upper 20bytes, need change mtu-exchange. to api level 21, can use requestmtu ( android developer ), negotiates peripherical device , can define until 512 bytes. the mtu value defined in peripherical side. remember data size can send mtu-3 bytes. for api level less 21, mtu pre-defined , can't modify.

Google analytics email open tracking with measurement protocol -

we tried track email opens google analytics , measurement protocol. followed instructions given in http://www.lunametrics.com/blog/2013/06/17/email-tracking-google-analytics/ , http://dyn.com/blog/tracking-email-opens-via-google-analytics/ the problem every email open counted session not correct. can give me advice how can track opens without recording sessions? thank you every hit in ga starts session, not possible. if don't want appear in normal profile, try setting pageview prefix can filter them out seperate view. e.g. /virtual/email-open then set filters.

php - Read merged cells PhPExcel -

i'm trying read merged cell in phpexcel, problem cell merged on a:b:c:d:e:f ( can't argue want ) $i= 0; foreach ($worksheet->getrowiterator() $row) { if ($i > 10) break ; $i ++; $celliterator = $row->getcelliterator(); foreach ($celliterator $cell) { if($cell->getcolumn()== 'a:b:c:d:e:f'){ $specification=$cell->getcalculatedvalue(); var_dump($specification);die(); // other code always dumps null. i've tried $cell->getcolumn()== 'a' since cell starts @ a, dumps null well. i appreciate help. i don't understand you're trying here, because getcolumn() ever return single column address a or b , never 'a:b:c:d:e:f' it may sensible iterate existing cells using $celliterator->setiterateonlyexistingcells(true); but there's couple of functions may merged cells: $cell->isinmergerange() will return boolean true/false, indicating if cell part o

c# - Web API - Accept incoming POST, pass off operation and close connection ASAP -

i have interaction server makes post calls web app. problem have server making calls tends lock records app go update. so need accept post, pass off thread/process in background , connection closed possible. i've tried things like: public ihttpactionresult post(mytestmodel passin) { if (modelstate.isvalid) { logger.debut ("conn open); var tasks = new [] { _mymethod.passoutoperation(passin) } logger.debug ("conn closed"); return ok("ok"); } return badrequest("error in model"); } i can tell amount of time inbound requests take connections aren't being closed down be. in testing 3 consecutive posts web app. looking @ logs have expected entries connection open , closed @ top of log. closed connections @ bottom, after operations trying pass out have completed. has got tips? thanks in advance! for interested solved problem. i'm using: var tasks = new thread(() => { _mymethod.pa

java - Text Mining sql schema files -

i have collection of big sql files. files want keep "create table" , "alter table add constraint foreign key" statements. there toll can use mine 2 regular expressions? know use grep don't have linux you can build small java program obtain such sentences. e.g.: string input = new string(files.readallbytes(paths.get("file.sql")), "utf-8"); string regex = "(?i)((create table|alter table add constraint foreign key)[^;]+;)" .replace(" ", "\\s+"); pattern pattern = pattern.compile(regex); matcher matcher = pattern.matcher(input); while (matcher.find()) { system.out.println(matcher.group()); }

javascript - How to open android application from a webpage? -

can call app html? for example:i can call webpage code correctly app. android code: startactivity(new intent(intent.action_view, uri.parse( "mydomain.com"))); and after doing in site, want open android app again. i find code, <a href="market://details?id=info.androidhive.slidingmenu"> but it's call market find , install app! you might have @ this: https://developer.android.com/training/app-indexing/deep-linking.html <activity android:name="com.example.android.gizmosactivity" android:label="@string/title_gizmos" > <intent-filter android:label="@string/filter_title_viewgizmos"> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <!-- accepts uris begin "http:/

ios - tableview contentsize not get updated, when changing NSLayoutConstraint's constant -

i have added bottom constraint on tableview, , change constant of constrain programmatically when keyboard appears. tableview's frame resizes, contentsize not updating, why? how can force recalculate. i have tried many approach. nsnotificationcenter.defaultcenter().addobserverforname(uikeyboarddidshownotification, object: nil, queue:nsoperationqueue.mainqueue(), usingblock: {(notification: nsnotification?) -> () in let keyboardsize = (notification!.userinfo![uikeyboardframebeginuserinfokey] as? nsvalue)!.cgrectvalue().size self.bottomconstraint.constant = keyboardsize.height self.view.layoutifneeded() if let messagetableviewcontroller2 = messagetableviewcontroller, let messageviewsize2 = messageviewsize { /*var frame = messagetableviewcontroller2.tableview.frame frame.size.height = messageviewsize2.height - keyboardsize.height - 44 messagetableviewcontroller2.tableview.frame = frame*/ /*messagetableviewcontroller2.table

How to use GROUP_CONCAT in Stored procedure MySQL -

i'm trying use comma separated values (@job_skills) in query follows in stored procedure. not work expected. amy consider first value comma separated string. there other way patch ? select group_concat(skillid) job_skills tbljob_skill jskl jskl.jobpostingid = param_jobid @job_skills; block6: begin declare curl_job12 cursor select * (select js.jobseekerid tbljobseeker_skill jss inner join tbmstjobseeker js on (js.jobseekerid = jss.jobseekerid) inner join tblrecommended_jobseekers_details rjd on (js.jobseekerid=rjd.jobseekerid) jss.skillid in (@job_skills) , js.isactive = 'y' , js.lat<>0 , js.lang<>0 , rjd.sessionid=param_sessionid group js.jobseekerid) m; declare continue handler not found set job_done12 = true; open curl_job12; read_loop_job12: loop fetch curl_job12 jsid, miles; if job_done12 leave read_loop_job12; end if; insert te

video - playing h264 rtp stream in android -

i trying stream h264 video arm development board using gstreamer , play in android mobile using available video player mxplayer, vlc etc. not able play stream in android mobile. gstreamer pipeline: gst-launch filesrc location=./test.mp4 ! decodebin ! vpuenc ! rtph264pay ! udpsink host=224.0.0.1 port=3000 auto-multicast=true multicast-iface=wlan0 vlc: rtp://@224.0.0.1:3000 but able stream audio , play without issue able play video stream in android mobile using gstreamer android based application. can me resolve issue?

java - Multiply my a number with a float? -

the problem i'm facing code if statement doesn't work when multiply number float. such int x; float xratio = 1.0; if ( x > 600 * xratio && x < 1320 * xratio) { // (draw on canvas android) } however, when try this float xcompare1 = 1320 * xratio; system.out.println(xcompare1); it either prints 0 or nan . i don't understand why if statement doesn't work, works when use in this if (x > 100 * xratio && x < 599 * xratio) { // } it works , it's confusing me // edit well how define xratio , xvalue point size = new point(); this.getwindowmanager().getdefaultdisplay.getrealsize(size); double width = size.x; float xratio = (float) width/1920; x+= 20; canvas.drawbitmap(bitmap, x, 0, null); i tried working, need change float xratio = 1.0; float xratio = 1.0f;

Mysql filter double dates -

i busy writing php program check products have being sold on specific date. now facing problem same date being put database multiple times. so when want read dates see dates displaying 10 times. this query : select date sales order date desc i have being looking on internet while now, cant seem find it. if give me little hand great. thanks in forehand you use distinct : select distinct date sales order date desc;

ios - NSDate get all short days of the week? -

i need days of week in short mode, this: sun,mon,etc .. i have tried this: nsdateformatter * df = [[nsdateformatter alloc] init]; [df setlocale:[[nslocale alloc] initwithlocaleidentifier:[[nslocale preferredlanguages] objectatindex:0]]]; [df setdateformat:@"c"]; which gives full names, how short ones? nsdateformatter * formatter = [[nsdateformatter alloc] init]; nsarray * shortweeks = [formatter shortweekdaysymbols]; nslog(@"%@",shortweeks); log 2015-07-14 17:25:31.470 newoctest[9016:286325] ( sun, mon, tue, wed, thu, fri, sat ) also,there veryshortweekdaysymbols in dateformatter nsdateformatter * formatter = [[nsdateformatter alloc] init]; nsarray * shortweeks = [formatter veryshortweekdaysymbols]; nslog(@"%@",shortweeks); log 2015-07-14 17:30:30.686 newoctest[9073:290513] ( s, m, t, w, t, f, s )

What in an asp.net web site could prevent an html page opening in quirks mode? -

we use iis8 our web server. have old html page renders in quirks mode (which want) in ie10 when in virtual directory. not have tag force quirks mode. if page rendered within folder in asp.net web site not render in quirks mode , therefore renders incorectly. we assume we've changed in web site configuration prevents page rendering in quirks mode default. can suggest might be? to avoid writing essay on why we're doing we're doing let me we'd prefer not have change html page force quirks mode, or change in way in fact. mode convenient establish change has caused page not render in quirks mode default , make change in application installer change our customers' web sites automatically. edit: forgot mention in both cases i'm using compatibilty mode. edit 2: we're targetting .net 4.5 , i've read stuff online says disables quirks mode. edit 3: seems switched 4.5 before problem became apparent. edit 4: answer twofold. prompted andrew morton'

javascript - Nested promise returns undefined -

i'm trying write tests cucumber.js using protractor , chai-as-promised. in page object have these fragments of code: var menusonlistelements = element.all(by.repeater('menu in menus').column('menu.name')) this.ismenulisted = function(menu) { return menusonlistelements.each(function(element) { return element.gettext().then(function (name) { if (menu.name === name) { return true; //this executed } }); }); }; and in step definition code do: var menu = {}; menu.name = 'abc'; expect(new menuspage().ismenulisted(menu)).to.eventually.be.true.notify(done); when run test get expected undefined true which means ismenulisted method returned undefined instead of true. however, debugged , can see 'return true;' statement executed. am missing how promises work in case? alternatively, can apply reduce() here: this.ismenulisted = function(menu) { return menusonli

java - JavaFX- Edit the cell value at a dynamic TableView? -

is possible edit cell vale @ dynamic tableview (dynamic rows , dynamic columns)? all found on internet editable textfileds on cells. want edit value on table , update list new data. i'm using intellij idea 13.1.4 , javafx scene builder 2.0 , newest javafx version. thanks help... here code, create dynamic rows , columns: public list<string[]> jdata = new linkedlist<>(); //here data private tableview<string[]> sourcetable; private observablelist<string[]> srcdata; . . . int clms; public void showtable(convert cnv) { clms = cnv.getcolums(); //number of columns (int = 0; < clms; i++) { tablecolumn<string[], string> firstnamecol = new tablecolumn<>("\tc"+(i+1)+" \t"); firstnamecol.setminwidth(20); int index = ; firstnamecol.setcellvaluefactory(celldata -> { string[] rowdata = celldata.getvalue(); if (index >