Posts

Showing posts from February, 2014

c# - Copy an msi to memory, then create a Database object from it -

i'm in deep end here, please accept apologies not knowing i'm on about. my aim take existing msi, make alterations it, create transform it, leaving msi in it's original state. i'm using dtf (part of wix), suggested in many other questions. my problem stems fact need 2 database objects create transform; altered database , reference. can't create 2 object same file because first object locks it. trivial option create copy of file in temp directory , create new object new filepath. however, want avoid writing disk except save transform, program may used varying mixtures of vms, local storage , network storage. from gather, dtf allow create database object handle, current approach somehow create copy of msi in memory handle , pass database constructor create temporary object can make changes before creating transform off it. i'm @ loss of how achieve this, though, , i'm not sure it's possible. memorymappedfile seemed place start, when creating 1 ...

r - How can I plot an irregular time series so the x axis points are equidistant? -

Image
i have irregular time series. each row represents x number of ticks, (datetime, price, volume) aggregated show hloc, using first tick of each group set datetime row. "time","open","high","low","close","sumvol","sumticks" ... 2016-01-15 11:14:43,4.74,4.74,4.7325,4.735,298,250 2016-01-15 11:14:56,4.735,4.735,4.7275,4.7325,475,250 2016-01-15 11:16:49,4.7325,4.76,4.7275,4.7575,903,250 2016-01-18 17:00:15,4.7575,4.765,4.75,4.755,327,250 2016-01-18 17:02:17,4.755,4.7575,4.7375,4.7375,398,250 2016-01-18 17:05:23,4.7375,4.7375,4.715,4.7175,395,250 2016-01-18 17:08:56,4.7175,4.72,4.7125,4.7175,509,250 2016-01-18 17:22:06,4.7175,4.725,4.7175,4.7175,326,250 2016-01-18 17:57:25,4.7175,4.7225,4.7125,4.7125,349,250 2016-01-18 18:33:55,4.7125,4.725,4.7125,4.725,293,250 2016-01-18 20:54:43,4.725,4.735,4.725,4.7275,272,250 2016-01-18 22:49:55,4.7275,4.73,4.72,4.7225,335,250 2016-01-19 00:14:32,4.7225,4.73,4.7225,4.73,430,250 ...

Storing data in FIWARE Object Storage -

i'm building application stores files fiware object storage. i don't quite understand correct way of storing files storage. the code python code snippet below taken object storage - user , programmers guide shows 2 ways of doing it: def store_text(token, auth, container_name, object_name, object_text): headers = {"x-auth-token": token} # 1. version #body = '{"mimetype":"text/plain", "metadata":{}, "value" : "' + object_text + '"}' # 2. version body = object_text url = auth + "/" + container_name + "/" + object_name return swift_request('put', url, headers, body) the 1. version confuses me, because when first looked @ node.js module (repo: fiware-object-storage ) works object storage, seemed use 1. version . module making calls old (v.1.1) api version instead of presumably newest (v.2.0), referencing python example, not sure if outdated ver...

java - Use ExecutorService to control thread execution time -

i'm new java concurrent package , want try executorservice control execution time of thread. so keep running thread mythread, want use executorservice , future class stop after 2 seconds. public class mythread extends thread { public static int count = 0; @override public void run() { while (true) { system.out.println(count++); } } } public static void main(string[] args) throws ioexception, interruptedexception { executorservice executorservice = executors.newfixedthreadpool(1); mythread thread = new mythread(); futuretask<string> futuretask = new futuretask<string>(thread, "success"); try { executorservice.submit(futuretask).get(2, timeunit.seconds); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (executionexception e) { // todo auto-generated catch block e.printstacktrace(); } catch...

jsf - Prevent user going to pages through address bar -

i have web application. after user login, want user navigate pages clicking on buttons or links instead of manually changing url on browser address bar. saw few posts can use security constraint so. have in web.xml. seems not work. <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <security-constraint> <display-name>restrict raw xhtml documents</display-name> <web-resource-collection> <web-resource-name>xhtml</web-resource-name> <url-pattern>/faces/*</url-pattern> </web-resource-collection> <auth-constraint /> </security-constraint> i not approa...

c# - Connecting to MySQL db using Entity Framework ADO.NET error -

i've been trying connect mysql database using ef6 in visual studio 2015 , following instructions answer found here: enable entity framework 6 mysql (c#) in winforms of microsoft visual studio 2013 , able passed of issues. however, after setting connection, testing it, , selecting correct db on server connection, when gets step of generating tables me import edmx file, closes out. don't know how else explain it, wizard closes out , i'm @ main vs screen. no error message, no nothing, cancels out. causing this? some additional information: -i have establish open connection server first before can connect on machine (we're using forticlient). -it's mysql database, followed steps in linked page work vs already.

jquery - Remove css style from element -

i remove parent styling added css stylesheet using jquery. googled can find removing inline styles or classes html <p><span>text</span></p> css p{ width:300px; height:200px; border:solid 3px #000; padding:10px; font-size:23px; } span{ width:100%; height:100%; background: #ccc; padding:10px; } i tried many jquery variations, 1 of them: $('span').parent().removeattr( 'style' ); jsfiddle example you can not removeattribute p because there no inline css or style attribute set p tag. you can overwrite default css using .css() what can do. $('span').parent('p').css({ width:350px;height:250px;border:solid 5px #000;padding:5px;font-size:20px;}); overwrite rules above create class parent p , use .removeclass() .

r - Display row names in a data.table object -

reference: while trying answer this basic question , realized wasn't able display rownames in data.table object toy example library(data.table) dt <- data.table(a = letters[1:3]) dt ## ## 1: ## 2: b ## 3: c row.names(dt) <- 4:6 row.names(dt) ## [1] "4" "5" "6" # seem work or rownames(dt) <- 7:9 rownames(dt) ## [1] "7" "8" "9" # seems ok but when displaying data itself, row names remains unchanged dt ## ## 1: ## 2: b ## 3: c i assume data.table ignores unnecessary attributes efficiency purposes, attributes seem disagree attributes(dt) # $names # [1] "a" # # $row.names # [1] 7 8 9 # # $class # [1] "data.table" "data.frame" # # $.internal.selfref # <pointer: 0x0000000000200788> this more or less verbatim comments. data.table doesn't support row names. intentional, row names bad design choice, because far more cumbersome use columns (...

pointers - Upgrading Fortran/C program from 32-bit to multi-architecture -

i'm looking @ old fortran program c calls works 32-bit systems, raises warnings , concerns 64-bit compilers. program stores address of c pointer dynamically allocated memory int , shared on fortran-side integer . concern on 64-bit integer systems, cast c pointer larger can stored int / integer . i've simplified existing program example 2 files. fortran: this.f program integer,pointer :: iptr allocate(iptr) call that_allocate(iptr) write(*,'(a, z12)') 'fortran: iptr address', iptr call that_assemble(iptr) call that_free(iptr) end program c: that.c #include <stdlib.h> #include <stdio.h> typedef struct data { int a; float b; } data; void that_allocate_(int* iptr) { data *pdata = calloc(1, sizeof(data)); *iptr = (int)pdata; printf("c: allocated address %p (or %d)\n", pdata, pdata); return; } void that_assemble_(int* iptr) { data *pdata = ...

javascript - Jquery text search and do something with that text -

i trying looks through div id of 'holder' , searches string. preferably string case-insensitive. string have input connected (variable 'terms'). once code has found paragraphs have string, add class them called 'found'. not have knowledge jquery (just basics) if me, fantastic! code far: <!doctype html> </html> <body> <p id="header">searcher</p> <hr> <p id="form"> <input autocomplete="off" id="bar" name="input" type="text" placeholder="search word or phrase"> <button type="button" id="sea" onclick="search ()">search</button> <br> </p> <div id="holder"> <p id="note">this test paragraph uses test.</p> <p id="note">for jquery. want search paragraph using "for jquery".</p...

c# - WPF: Give a ResourceDictionary a Name -

Image
i have got resourcedictionary full of pathgeometry's icons, possible can give resourcedictionary name can use c# view of icons, , make things more grouped together? so use 1 of pathgeometry's example app.current.resources.icons["refresh1"] geometry or app.current.resources["icons"]["refresh1"] geometry currently use app.current.resources["refresh1"] geometry use 1 of pathgeometry's. edit: unclear why is, well, unclear. poster below understood question unclear in reason wanting this. reason isn't required, want answer i'm asking, not discussion on why want this. this 1 of straightforward questions people spend more time arguing answering! :) people can argue merit of as once start doing things dynamically loading resourcedictionaries (say, external plugin dlls) topics become relevant indeed! to answer question, yes, of course possible. main caveat here if add resourcedictionaries application resources ...

How to Add Value in Indicator in Linear Scale Component on SCADA Ignition -

Image
i used linear scale component using ignition 7.8 display fuel level this: i want indicate current value of fuel in same scale. browse through property of linear scale component , couldn't property resembling value , text , number , or alike. how can display value in it? create data set component includes indicator arrow or line. then, use cell bindings bind tag indicator arrow. demo here: https://inductiveuniversity.com/video/cell-update-binding?r=/course/components-property-binding

javascript - Margin-top between firefox is difference from Chrome -

Image
my styling in css working chrome works differently firefox . html code: <input type="checkbox" checked data-toggle="toggle" data-onstyle="warning" data-on="公開 <div class='toggle_on'></div>" data-off="<div class='toggle_off'></div> 非公開"> here css code : .toggle_on { background: #fff; padding: 13px; float: right; margin-top: -5px; -moz-margin-top:-25px; margin-right: -20px; -webkit-box-shadow: 0px 7px 20px -2px rgba(117,112,117,1); -moz-box-shadow: 0px 7px 20px -2px rgba(117,112,117,1); box-shadow: 0px 7px 20px -2px rgba(117,112,117,1); border-radius: 3px; } and here result in chrome : and 1 in firefox : so idea this?? this errors happen not because of css because of html code: code before : <input type="checkbox" checked data-toggle="toggle" data-onstyle="warning" data-on="公開 ...

php - How to put an if statement inside a variable? -

$gallerydetails .=' <div class="col-md-3 product-left"> <p class = "tb">total bid: if($rowselectcounttotal > 0){$rowselectcounttotal}else {0}</p> </div> above code , try put if else statement inside variable cant work,how can put if else inside variable? simply do: $gallerydetails .=' <div class="col-md-3 product-left"> <p class = "tb">total bid: '.(($rowselectcounttotal > 0) ? $rowselectcounttotal : 0)'.</p> </div> this called shorthand if/else , , allows achieve you're trying do.

batch file - Check if SQL server service is running -

currently facing problem effects system stability, our server has sql server 2012 , unknown reason services stop running , needs restart manually every single day. have created command in batch file restart sql server automatically , works fine, however, looking better command can check if sql server stop, restart it, if running, ignore. how can command ? @echo off net start mssql$sqlexpress something this. pause optional. don't use if goes in scheduled task! in case wouldn't need echo statements either. of course need run administrative privileges start service. added check that. @echo off set "service=mssql$sqlexpress" rem make sure service exists sc query %service% | (findstr "does not exist" && goto :done) /f "tokens=1,2,3,4" %%a in ('sc query %service%') ( if /i %%a == state ( if /i not %%d == running ( echo(%service% state %%d. should running. rem openfiles requires admin ...

node.js - Finding Longitude Angle when distance is known -

i'm attempting find longitude (east-west) angle of new point given latitude not change. given: starting latitude, starting longitude, distance of travel in miles. desired result: maximum , minimum longitude , latitude degrees "distance of travel" starting point. code below: attempt 1: use "close enough" constants: function(longitude, latitude, travelradius, next){ var milesperdegreeoflongitude = 69.172; var milesperdegreeoflatitude = 69.2; var location = { longitude : longitude, latitude : latitude }; var longitudedelta = (travelradius / milesperdegreeoflongitude); location.maxlongitude = longitude + longitudedelta; location.minlongitude = longitude - longitudedelta; var latitudedelta = (travelradius / milesperdegreeoflatitude); location.maxlatitude = latitude + latitudedelta; location.minlatiude = latitude - latitudedelta; next(location); } ^ yields close latitude, distance of 5 miles. longitude same 3.93 miles measured google maps, high of...

Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) on CMake -

i'm trying use api.ai c++ library on windows 7. ( https://github.com/api-ai/libapiai ) can not configuring files.. i installed cmake , mingw. in build directory -> cmake .. -g "mingw makefiles" -> error !! ===>>> error below <<< cmake error @ c:/program files (x86)/cmake/share/cmake-3.4/modules/findpackagehandlestandardargs.cmake:148 (message): not find curl (missing: curl_library curl_include_dir) call stack (most recent call first): c:/program files (x86)/cmake/share/cmake-3.4/modules/findpackagehandlestandardargs.cmake:388 (_fphsa_failure_message) c:/program files (x86)/cmake/share/cmake-3.4/modules/findcurl.cmake:61 (find_package_handle_standard_args) cmakelists.txt:45 (find_package) i don't know how can solve. curl_library? can use on windows 7? not linux/unix etc.. just search internet curl! it's library transfer data url syntax. can download binaries it's download page or download source code , ...

c++ - FOR loop without condition value "for (int i = 1; ; i++)" doesn't work properly -

i found post loop used without condition value. here loop: for (initialization; condition; afterthought) { // code for-loop's body goes here. } it's not safe skip condition value, if use if/else statement can done. please take on loop: for (int = 1; ; i++) , implementation inside. reason, don't proper logic if/else statement. #include <iostream> using namespace std; int main() { int boxes; int boxes_for_sale; cout << "enter quantity of boxes in warehouse: > " << flush; cin >> boxes; cout << "enter quantity of boxes sale: > " << flush; cin >> boxes_for_sale; (int = 1;; i++) { if (boxes < boxes_for_sale) { cout << "there not enough boxes in warehouse!" << endl; cout << "enter quantity of boxes sale: > " << flush; cin >> boxes_for_sale; } else ...

android - SIM Card Mobile Application Pre Load -

not directly code related question, though think right place ask. does know, if how , requirements needed, if it's possible pre-load ios application and/or android application on sim card. after user sticks in phone , loads them onto device. i know used possible old nokia phones telecom provider loaded app on sim card, though not sure how work security wise current ios , android. if push me in right direction, appreciated. if it's not possible, know of alternative solution? there no way access data sim card using ios sdk apparently, not possible if fit app or url apps webpage on sim card. https://stackoverflow.com/a/15380308/1219956 as android can access info sim card, not arbitrary data written (which im not sure how onto sim in first place) how read sim raw data on android?

Can not find jnlp-api in java-8-openjdk -

switched java platform oracle's jdk8 openjdk , cannot build maven project. could not find artifact javax.jnlp:jnlp-api:jar:8.0 @ specified path /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/javaws.jar switching oracle jdk8 allows build proceed. where can find jnlp-api openjdk 8? there pom available?

node.js - Is there an ExpressJS middleware for RequireJS optimizer? -

i don't want use build process run requirejs optimizer. there expressjs middleware requirejs optimizer? can try example optimizing. configures app optimize js files, , use it. should work middleware.

ibm - "No terminal library found error" during vim configure -

i tried build vim 7.4 in ibm aix 6.1. when run configure script ./configure getting following error checking --with-tlib argument... empty: automatic terminal library selection checking tgetent in -ltinfo... no checking tgetent in -lncurses... no checking tgetent in -ltermlib... no checking tgetent in -ltermcap... no checking tgetent in -lcurses... no no terminal library found checking tgetent()... configure: error: not found! need install terminal library; example ncurses. or specify name of library --with-tlib. inspecting config.info able see following error | int | main () | { | char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); | ; | return 0; | } configure:10492: error: not found! need install terminal library; example ncurses. or specify name of library --with-tlib. but curses library (libcurses.a) present in /usr/lib directory. tried following command ./configure --with-tlib=curses , time getting different error...

php - Get Variable from Load Page -

i'm trying variable load page using jquery , php. let if have 2 pages. no-1.php page form display , have <select> list user have choose states , when user click, loads new <select> list page no-2.php inside <div> . user have select staff name based on state user choose earlier on page-1.php`. here codes made no-1.php (jquery call function user make selection on state) $(document).ready(function() { var p_id = $("#p_id").val(); //value form on page no-1.php var pid = $("#pid").val(); //value form on page no-1.php $('#list').load('no-2.php', { "pid": pid, "p_id": p_id }); $('#lokasi').change(function() { //#lokasi state user choose $.ajax({ type: "get", url: "no-2.php", data: { mlk: $(this).val() //value of state } }).done(function(data) { $(...

ios - iOS5 facebook integration -

i trying integrate "social option" app. i have ios6, idea have app available ios5. using twitter framework has been simple , works in devices r.0 version , 6.0 version. regarding facebook, not understand how integrate it. need "post wall" function. i know exists in social.framework in ios5? social framework not exist in ios 5. facebook has extensive developer tutorial: here

eclipse - Java files are not showing errors -

Image
i have imported ant project in image svn. when edit java files not showing errors. settings need change? by adding src folder project build path issue got resolved.

ruby on rails - What's the easiest way to make HTTParty return an object/class rather than a JSON response? -

right call: def child(parent_id, child_id, params = {}) if @api_token self.class.get("/parents/#{parent_id}/children/#{child_id}", query: params, :headers=>{"authorization"=>"token token=#{@api_token}"}) else self.class.get("/parents/#{parent_id}/children/#{child_id}", query: params) end end it returns json response directly api hash. there easy way me standardize response parses json , generates class? example: original response -------- {'child' : { 'name' : 'john doe', 'age' : 23 } } desired response -------- res.name # john doe res.age # 23 res.class # apiclient::child it can achieved via custom parser passed request call (however advise not , leave now) an example of parser pass class instanceparser < httparty::parser def parse #assuming have json in format { 'one_key_mapping_to_model' => data } body_as_json = ...

ruby on rails - How do I generate a normal looking URL for a delete User with Devise, rather than a URL with a format? -

on settings page of user account, want add cancel button. issue keep having normal things keep creating url has .format . this in view: <%= link_to "cancel account", cancel_user_account_path(resource), data: { confirm: "are sure want cancel account? of memories lost!" }, method: :delete, class: "btn left" %> routes delete "cancel", to: "users#destroy", as: :cancel_user_account which generates in rake routes : cancel_user_account_path delete /cancel(.:format) users#destroy this user#destroy looks like: def destroy @user = user.find(params[:id]) if @user.destroy redirect_to root_path, notice: "you have cancelled account." else redirect_to :back end end that's normal. but keeps generating url: http://localhost:3000/cancel.148 which generates error when clicked: started delete "/cancel.148" 127.0.0.1 @ 2016-01-21 00:30:02 -0500 processing us...

php - Live count of users on website which updates html -

hi have made site , wondering if can put count of how many people on site. not have been on how many on @ time. live count updates if exits. if can use php database awesome. have no experience sort of stuff love have on site. i think can session. hope thread may helps you. finding total number of active sessions

c# - auto check to items in wpf check Listbox -

i have check list box in wpf. email ids populated using public observablecollection<boolstringclass> thelist { get; set; } method @ runtime. when user save record selecetd email ids saved in database(123@gmail.com;456@yahoo.co.in;789@rediff.com).. , on comma separated. now when want reload data on controls database, how can keep checked items stored in database ? in windows forms easy achieve this, how can done in wpf? better have observablecollection of emailitem , have string , isselected property. bind collection check box list. , set isselected based on whether saved in database

java - Convert a text file to a sql file -

i working on assignment open text file , convert/save sql file. got how open text file stuck on how convert sql file. here code got reading text file public static void main(string[] args) { // path open file. string filename = "input.txt"; string line = null; try { // file reads text files filereader file = new filereader(filename); // wrap file in bufferedreader bufferedreader bufferedreader = new bufferedreader(file); while ( (line = bufferedreader.readline()) != null ) { system.out.println(line); } // close files bufferedreader.close(); } catch ( filenotfoundexception ex ) { system.out.println("unable open file '" + filename + "'"); } catch ( ioexception ex ) { ex.printstacktrace(); } } can give me hint how save text file sql file ...

javascript - Testing Angular Factory with Jasmine is not working -

i'm new jasmine. i've written simple code execute in js fiddle working fine. but, when include jasmine code, not working. missing here? var app = angular.module('sortmodule', []) app.factory('sortfactory', function(){ var sortedcolors = [] var shouldpush = true; return { sortcolors: function(colorsarray){ var colorsorder = [{color:'green'},{color:'yellow'},{color:'blue'},{color:'red'}] for(color in colorsorder) { for(objcolor in colorsarray) { shouldpush = colorsorder[color].color === colorsarray[objcolor].color ? true : false if(shouldpush) {sortedcolors.push(colorsarray[objcolor]);} } } return sortedcolors; } } }); app.controller('sortcontroller', function($scope,sortfactory){ $scope.colorsarray = [{id: '1',color: 'red',code : '#ff0000'},{id: '2',color: 'blue',code : ...

java - Tib RV - listing all the processes that are publishing to a given topic -

we have rv messaging systems publishing , receiving messages.recently underlying jars upgraded - these serialization jars used publishers , subscribers. , seems some of publishers still referencing old versions of serialization jars , therefore receivers fail when trying deserialize received messages. obviously restarting these publisher services should fix problem. , how identify all publishers using particular topic send messages ? there must rv admin way of listing processes publishing given topic ? i gave similar answer on question: there great tool called rai insight basically can sit on box , silently listen multicast data , represent statistics in real time. used monitor traffic flow spikes few seconds delay. it can give traffic statistics braked down multicast group, service number or sending machine. traffic flow peak/average, retransmission rate peak/average. can think of. it give per-service per-topic information.

How can I update my plugin in android studio? -

i building golf score card app android studio , last night before shut down laptop building fine, however, morning when run android studio got error "plugin old, please update more recent version, or set android_daily_override environment variable "aed79d567e57792ed352e708d2b7ca891ff897c6"" , app structure has altered , there no longer manifest folder..... image of app structure`` below gradle file: apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.example.biko.golfstroke" minsdkversion 8 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: ...

iphone - 3D image functionality in iOS -

i want know how 3d functionality in fyuse app works. have worked on image 3d transformation using self.imageview.transform = cgaffinetransformmakerotation(); but feels app using thing different. i suppose, fyuse's app 3d image number of images of object, whiсh taken different positions, change 1 swipe, , makes 3d effect.

c# - pass array to stored procedure -

i have pass arrays , strings stored procedure , return data table c# side: public datatable fetchrequested(string [] empid, string [] account, string [] refno, string orgid, string id, datetime valuedate) { string connetionstring = null; oracleconnection con; oracledataadapter objadapter = null; oraclecommand objcomm = new oraclecommand(); connetionstring = @"data source= payment_devlope; user id=orgpayment;password=orgpayment"; con = new oracleconnection (connetionstring); try { con.open(); objcomm.connection = con; objcomm.commandtype = commandtype.storedprocedure; objcomm.commandtext = "pkg_reports.requested_payment"; // add , set procedure parameters //////////////////////////////////////////////////////////////////// objcomm.parameters.add(...

php - Is a mysql LIKE statement with an escaped string containing unescaped wildcards '%' (percent) or '_' (underscore) vulnerable? -

let's have following code (for kind of search or similar): $stmt = $pdo->prepare("select * users username ?"); $stmt->execute(array('%' . $username . '%')); the username supplied escaped, characters % (= 0 or more arbitrary characters) , _ (= 1 arbitrary characters) interpreted wildcard mysql. i understand users enter % or _ search , should escape if want search function work properly. (in cases set_pt , getting setopt in result). but question is: exploit this? if yes, how exploit , how prevent it? function below suffice? function escape_like_string($str) { return str_replace(array('%', '_'), array('\%', '\_'), $str); } one possibility think of entering tons of % , server need allocate lot of memory. work? could exploit this? for sql-injection? no. for easter-egg behavior? probably. in case, if don't want let users use wildcards in search, can 2 things: proper escape wildc...

ios - watchconnectivity not working on device - only simulator -

i have followed many tutorials online , seen how connect watch iphone able send data , have following code to: send: watchsession.sendmessage(["name":"maz"], replyhandler: nil) { (error) -> void in } receive: func session(session: wcsession, didreceivemessage message: [string : anyobject]) { mylabel.settext(message["name"]! as? string) //reloadwatchtable() } the code works when use simulator not when i'm running on iphone , apple watch.

html - CSS Resize images to fit in a container -

Image
i want fit images in container different images size : example : 1. full size in container bigger size. 2. middle in container horizontal size. 3. middle in container vertical size. check out example link as gautam said, need use max-height:100%; max-width: 100%; so can define class containers .container { display:flex; align-items:center; justify-content:center; border:1px solid black; background-color: #ffffff; width: 50px; height: 50px; } and class images .maxsize { max-height:100%; max-width: 100%; } the display:flex; property makes container easier config, can center contents faster. can remove border property, it's easier viewing of container edges. hope helps. updated jsfiddle

ssl - What TLS method is better for port 587? -

what suggested method securing submission port 587 on smtp server , starttls command or direct tls layer? i tend use (mandatory) starttls command , not direct tls layer. in case of problems, starttls command can disabled without changing mua`s configuration. think in case of direct usage of tls layer not straightforward. are there other suggestions, opinions ? didn't find out if standardised in rfc. you don't have choice. port 587 starttls command. standard port allowing ssl-wrapped ("direct tls") connection port 465.

c# - add dynamic anonymous object into linq groupBy expression -

i have following linq expression: func<entity, object> groupquery = item => new { = item.attributes["name"], item = item.attributes["number"] }; var result = target.collection.entities.groupby(groupquery).tolist(); but if don't know, how columns group (for example 3 instead of 2),and names of attributes stored in list names, how should change groupquery object? first idea create dynamic object don't work dynamic groupquery= new expandoobject(); idictionary<string, object> dictionary = (idictionary<string, object>)groupquery; foreach (string str in names) { dictionary.add(str, str); } instead of returning object groupquery can return string. string constructed properties of objects want group. depending on configuration can generated in different ways i.e. based on different properties. here code shows idea: public class { public string property1 { get; set; } public string property2 { get; set; } ...

c# - Entity Framework Model Builder Configuration using Reflection -

i want call below code using reflection: modelbuilder.entity<cardpayment>().map(m => { m.mapinheritedproperties(); m.totable("cardpayments"); }); i trying following: var entitymethod = typeof(dbmodelbuilder).getmethod("entity"); entitymethod.makegenericmethod(type) .invoke(modelbuilder, new object[] { }); how call " map " method parameters supplying "map" method. how can invoke " mapinheritedproperties " , " totable " methods within "map" method. thanks you need capture return object entitymethod.makegenericmethod(type).invoke(modelbuilder, new object[] { }); , can dynamically invoke map : var maplambda = /* you'll need fix typing here */(m) => { m.mapinheritedproperties(); m.totable("cardpayments"); }; var entitymethod = typeof(dbmodelbuilder).getmethod(...

postgresql - How is compiled PL/pgSQL block? -

$$ declare tm1 timestamp without time zone; tm2 timestamp without time zone; begin select localtimestamp(0) tm1; in 1..200000000 loop --just waiting several second end loop; select localtimestamp(0) tm2; raise notice '% ; %', tm1, tm2; end; $$ language plpgsql why gives procedure same values tm1 , tm2 ? is not executed code step step? from manual these sql-standard functions return values based on start time of current transaction [...] since these functions return start time of current transaction, values do not change during transaction . considered feature: intent allow single transaction have consistent notion of "current" time, multiple modifications within same transaction bear same time stamp (emphasis mine) you want clock_timestamp()

String Array class in JAVA -

i need code problem write java class having string array, global visibility. add method adds given sting string array. add method searches given string in string array. add method searches given character in string array. method should count , returns occurrence of given character. write appropriate main method test these class methods. and code. first, created class method create scound class teststring array my question have error in scound class ,and try fix dose not work first class: /* * change template, choose tools | templates * , open template in editor. */ package ooplab3; public class stringarray { string[] sta = null; int index = 0; //last added sring position in string array public stringarray() { } public string[] getsta() { return sta; } public string getstaindex(int i) { return sta[i]; } public int getcounter() { r...

c# - Adding a node in the beginning of XML parent node -

i wanted add xmlnode in parent @ top/beginning. there variant of xmlnode.appendchild() can use? as far understand question looking xmlnode.prependchild() method. example: xmldocument doc = new xmldocument(); xmlnode root = doc.documentelement; //create new node. xmlelement node = doc.createelement("price"); //add node document. root.prependchild(node); msdn documentation

mysql - SQL Statement Database -

i have mysql table holds dates booked (for holiday properties). example... table "listing_availability" rows... availability_date (this shows date format 2013-04-20 etc) availability_bookable (this can yes/no. "yes" = booking changeover day , "available". "no" means property booked dates) all other dates in year (apart ones "no") available booked. these dates not in database, booked dates. my question is... have make sql statement first calls date function (not sure if correct terminology) then removes dates "availability_date" "availability_bookable" = "no" this give me dates available bookings, year, property. can help? regards m seems you've written query. select availability_date listing_availability availability_bookable <> 'no' , availability_date >= curdate() , year(curdate()) = year(availability_date)

java - Eclipse Build Process -

how eclipse build application (java/android) while ignoring errors? because when compile java class on command line or using ant - end getting errors - whereas can ignored in build process eclipse. for example, non static variable cannot referenced static context compilation error on command line when try build application through ant - eclipse java compiler can set warning , allow process complete. can me understand process? eclipse contains own compiler (the eclipse compiler java, ecj) able report compilation problems ide , even, in cases, partially compile classes when can limit "damage" caused error (such single method).

%load_ext rpy2.ipython works in iPython but not in iPython Notebook -

i have problem rpy2 running in ipython notebook. if load %load_ext rpy2.ipython in ipython 4.0.3 fine. if same thing in ipython notebook get: --------------------------------------------------------------------------- filenotfounderror traceback (most recent call last) <ipython-input-3-a69f80d0128e> in <module>() ----> 1 get_ipython().magic('load_ext rpy2.ipython') c:\anaconda3\lib\site-packages\ipython\core\interactiveshell.py in magic(self, arg_s) 2334 magic_name, _, magic_arg_s = arg_s.partition(' ') 2335 magic_name = magic_name.lstrip(prefilter.esc_magic) -> 2336 return self.run_line_magic(magic_name, magic_arg_s) 2337 2338 #------------------------------------------------------------------------- c:\anaconda3\lib\site-packages\ipython\core\interactiveshell.py in run_line_magic(self, magic_name, line) 2255 kwargs['local_ns'] = sys._getframe(stac...

php - yii pagination with array -

i trying yii pagination , followed example . how ever not seem work me. want paginate array of string values. following have: controller $location = $this->location($_server['server_name']); $files = $this->getfiles("/data/scan/invoice"); $page = (isset($_get['page']) ? $_get['page'] : 1); $item_count = count($files); $pages = new cpagination($item_count); $pages->setpagesize(yii::app()->params['listperpage']); $criteria = new cdbcriteria(); $pages->applylimit($criteria); // trick here! $this->render('index',array( "location"=>$location, "files"=>$files, 'item_count'=>$item_count, 'page_size'=>yii::app()->params['listperpage'], 'pages'=>$pages )); view <div id="main"> <table> <?php foreach($files $q): ?> ...

python - Secure Azure API rest calls in javascript -

we using azure api management maps python flask api. making javascript ajax calls (azure apis). placing subscription key directly in query parameter of ajax calls. now have access key (by pressing developer tools or view source), can access apis' well. is there way hide subscription key in ajax calls? you can use json web token (jwt) in request, has signature , expiration time.