Posts

Showing posts from February, 2015

matlab - Garment Cropping from mannequin -

Image
i have 2 images – mannequin with , without garment. please refer sample images below. ignore jewels, footwear on mannequin, imagine second mannequin has only dress . i want extract garment 2 images further processing. the complexity there slight displacement in position of camera when taking 2 pictures. due simple subtraction generate garment mask not work. can tell me how handle it? i think need registration between 2 images can extract garment image? any references blogs, articles , codes highly appreciated. -- thanks idea this idea of how it, haven't tested gut tells me might work. i'm assuming there slight differences in pose of manequin camera attitude. let original image a , , clothed image b . take difference d = |a - b| , apply median filter proportional largest deviation expect pose , camera attitude error: dmedian = median(d, kernelsize) . quantize dmedian binary mask dmask = q(dmedian, threshold) using appropriate thres...

How to make a full screen Google Map with website menu overlay? -

i building website consist of large (manipulable) graphs , google maps overlayed different kinds of data. website navigation horizontal bar of html divs across top -- not way across top. i want find way make maps api/app display "underneath" navigation , take entire rest of window. can advise? do mean this: http://jsfiddle.net/8ppjh/1/ add container: <div id="container"> <div id="nav">nav menu</div> <div id="map"></div> </div> set styles: html { height: 100% } body { height: 100%; margin: 0px; padding: 0px } #container { width: 100%; height: 100% } #nav { z-index: 100; position: absolute; margin: 10px 0px 0px 200px; background-color: #fff; border: 1px #000 solid; padding: 5px; } #map { width: 100%; height: 100% } load map: var mapoptions = { center: new google.maps.latlng(40.435833800555567, -78.44189453125), maptypeid: google.maps.maptypeid.r...

mod rewrite - Apache mod_rewrite logging -

i can't mod_rewrite log it's doing. can imagine makes debugging mod_rewrite ... challenging. i've followed "instructions" @ http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html (i'm running 2.2.22 on mac), except they're missing critical details like... of config files put configuration in, , in level of xml elements. rewritelog "/tmp/rewrite.log" rewriteloglevel 8 where put these directives logging mod_rewrite doing? /tmp/rewrite.log created, apache has clue want, logs nothing @ file.

How to find the difference between two dates for the same id in MySQL? -

i have mysql database containing ticket id, create time of ticket , create time of each interaction between company operator , client. i total awaiting time on client , company side same ticket id. id      id_ticket      id_sender      time 1       123             1               2010-04-26 03:32:44 2       159             1               2010-04-26 03:40:44 3       983             1               2010-04-26 04:44:26 4       159             2               2010-04-26 05:12:35 5       159             1               2010-04-26 06:25:45 6       123             2               2010-04-26 08:46:12 7       159             2               2010-04-26 09:36:25 8       123             1               2010-04-26 12:48:39 id_side either company or client answer. is there way in mysql ? thanks. [as example, total awaiting time customer (id_sender = 1) ticket #123 (2010-04-26 08:46:12 - 2010-04-26 03:32:44) + (2010-04-26 12:48:39 - 2...

html - Vertically centering a div inside another div with unknown height in a responsive layout -

sample webpage please take @ above website. possible have blocks of pictures vertically centered inside container? in other words, having div class of row-fluid vertically centered inside div class of featured-projects. to give css row-fluid class & give height of container. css .row-fluid { display: table-cell; vertical-align: middle; height: 300px; } abd remove padding-top:2em featured-products class

ios - Facebook SDK friendlist request -

i got time request timed out error when try load of facebook friend. i have fbsessionopen state. code: [fbrequestconnection startformyfriendswithcompletionhandler:^(fbrequestconnection *connection, id data, nserror *error) { if(error) { nslog(@"error: %@", error); [self.delegate didfinishloadingfriendswithresult:[errorresponse errorresponsewithmessage:@"failed load user friends facebook"] succes:no]; return; } nsarray* friends = (nsarray*)[data data]; nslog(@"you have %d friends", [friends count]); nslog(@"friends: %@", friends); [self.delegate didfinishloadingfriendswithresult:friends succes:yes]; }]; error message: error: error domain=com.facebook.sdk code=5 "the operation couldn’t completed. (com.facebook.sdk error 5.)" userinfo=0x1d1e3a30 {com.facebook.sdk:errorinnererrorkey=error domain=nsurlerrordomain code=-1001 "the request timed out." userinfo=0x1d1e16a0 {nse...

Unicode in HTML newsletter subject -

i'm preparing newsletter in chinese , i'm therefore converting text unicode minimize viewing problems. however, receiving email clients showing unicode representations instead of characters in subject line, i.e.: &#21697;&#20840;&#26032;&#32593; etc. for contents, working correctly. i've set <meta http-equiv="content-type" content="text/html; charset=utf-8" /> and on can't working. any ideas? not of many unicode symbols render consistently in every possible mail user agent subscribers use viewing emails. not regards email header fields subject line sender name. restriction equally applies utf-8 character encoding , using html entities in email body. if want put non-ascii characters in subject lines, can tell not work reliably. for example: iphone not support chinese characters in email interface. but... safari support chinese character in email subject line not in email body. have read @ ...

asp.net mvc - How can I limit the maximum number of selected CheckBoxes? -

on page there checkboxlist. create this: @foreach (var project in model.projects) { <input type="checkbox" id="@project.name" name="projects" value="@project.id" title="@project.name" /> <label for="@project.name">@project.name</label><br/> } how can limit maximum number of selected checkboxes? try this: int count = 1; int maxnoofselected = 1; @foreach (var project in model.projects) { if(count <= maxnoofselected) { <input type="checkbox" id="@project.name" name="projects" value="@project.id" title="@project.name" checked="checked" /> <label for="@project.name">@project.name</label><br/> @count++; } else { <input type="checkbox" ...

joomla2.5 - Joomla CiviCRM add duplicate field in joomla front-end profile form -

Image
can 1 how add duplicate field in joomla front-end profile form? have add 2 website field in same form. i using joomla 2.5 , civicrm 4.3.4. have configured front-end profile form , task completed. 1 thing blocked way. d have searched lot, not answer. can 1 me in regard ? any appreciable. i attaching form screen shot. civicrm not support adding multiple website fields profile. can add custom field profile hold additional website. if want write little code can sync website field hook. see hook reference example joomla hook plugin setup

c# - Securely implementing two factor authentication -

i'm looking implementing 2 factor authentication in mvc, similar googles authenticator. since users won't have 2 factor authentication setup, want use 2 step process - 1 screen enter username , password, other screen enter 1 time password. my difficulty how securely store users username , password whilst entering 1 time password? receive password , reject or issue cookie, don't store password anywhere. however, 2 step can't issue cookie because user navigate action. equally, don't want send password user hidden element in form. what standard practice situation? the best can think of store username , password in session, i'm not sure how secure is. actually, don't need store password , wait authentication until second step passed. can implement 2 steps of authentication separately (each step usual authentication: authenticate or reject), , grant appropriate authorities users passed first step , second step accordingly. specifically, can...

logging - Emacs: log the time required for typing commands -

i'm emacs novice. i'm in middle of learning basic commands navigation, editing etc. some key-combinations take me longer complete...they require either more keys pressed or higher degree of finger-position acrobatics :). i'm wondering if knows if there existing emacs plugin that: recognises when user has begun typing command (e.g. 'c-' or 'm-' something) , records time @ instant, then waits until user has finished typing command (i.e. point @ command recognised, before command executed) , records time too, then appends simple logging info configurable file (e.g. writes 'command description', 'keys', 'entry duration') particular occurrence. why? perhaps it's overkill, save me time in future if able analyse such log file , determine commands have high usage frequency long completion time. such commands bound keys simpler humble fingers reach, example :). it nice learning exercise me write myself, i'd prefer save ...

android - In App Purchase You already own this item error -

i have 2 phones same user account. , subscribed product 1 device. when trying subscribe same in next device shows error message "you own item" . need subscribe same 2 devices concurrently. how can possible ? using v3 api billing. there restriction , 1 subscription per 1 account or ? please me solve issue. all purchases make synced across devices logged in same google account i.e. if make purchase on 1 device purchase available on other devices configured same google account , if try purchase same item again iap takes care of , won't let that. still if want purchase item multiple time(like healthpack in case of game) need inform playstore consumption of item if haven't consumed , in case need keep track of item yourself(use servers keep track of items) check video: http://www.youtube.com/watch?feature=player_embedded&v=dgcjpirpfsk

shell - SSH and agent for Ubuntu file transfer automation -

i had script used create dumps of database , transfers files ubuntu server linux machine, use scp file transfer prompts password every time, need automate it. had rsa public key of linux in ubuntu machine authorized_keys, when scp says permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) checked permissions , every thing passwordauthontication off etc no luck. can write password in script , use regardless of security provide 700 permissin , no 1 can access except me root user. this script: export db_dump_dir=/home/database_dump export db_name=database_name_$(date '+%y_%m_%d').sql mysqldump -u root mysql > ${db_dump_dir}/${db_name} if [ $? -eq 0 ];then scp -i /root/.ssh/id_rsa ${db_dump_dir}/${db_name} root@192.0.0.0: else echo "error generating database dump" fi the first things come mind are is server set allow key authentication authentication? (that's pubkeyauthentication yes in sshd_config ) is server allowing...

android pay - Wallet for digital goods : TVA and subscription frequency -

i use wallet digital goods 3 month on production annoying behaviour puzzling me. first of all, taxes taken account "initialpayment" not "recurrence" one. anoying since don't have api let server clients actualy pay. secondly, seems monthly frequency 30 days regardless of month. annoying since billing date in month shifts gradually. is possible missed in configuration of jwt have kind of behavior ? thx

javascript - How to create Image with custom text in php? -

i looking create product customization tool in php. tool allow user create own customization predefined mobile cover. have mobile cover image , looking allow user write 3 characters written in circle called monogram background color. i not sure how proceed ahead it. looking dynamically create image placed on mobile cover in such way looks part. here link sample image generated http://d13eowy7ljcd3.cloudfront.net/images/ark.png i looking way on how approach , php image handling libraries should make use of. i think should use imagemagick: http://php.net/manual/en/book.imagick.php need imagemagick installed on system, if not have dedicated server try gd http://es1.php.net/manual/en/book.image.php , think imagemagick more powerfull.

Using native sql in Native SQL Hibernate -

i have complex sql planning integrate , going integrateing hibernate through named query please advise can write native sql in hbm.xml file inside .. <![cdata[ ] tag , in pojos retrieve session.getnamedquery , please advise native sql approach best 1 ..!! want keep query in xml here how in xml file: <!-- stock.hbm.xml --> <hibernate-mapping> <class name="com.mkyong.common.stock" table="stock" ...> <id name="stockid" type="java.lang.integer"> <column name="stock_id" /> <generator class="identity" /> </id> <property name="stockcode" type="string"> <column name="stock_code" length="10" not-null="true" unique="true" /> </property> ... </class> <sql-query name="findstockbystockcodenative...

android - using viewHolder Interface to update state to Listview -

in code below in else section has gettag() inside of arrayadapter holder = (viewholder) convertview.gettag(); how use section update or latest state of view item , keep state consistent saved state is. if click checkbox or checked state of checkbox database , want displayed in correct state of checkbox? in app getting previous state of checkbox database , setting checkbox state when listview created, , if state of box changed change in state saved database , checkbox show change in state. in other words supposed put in section of code, besides gettag line? if ((convertview == null)){ layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); convertview = inflater.inflate(r.layout.smalltank_customer_row, null); holder = new viewholder(); holder.textviewone = (textview) convertview.findviewbyid(r.id.textview1); holder.textviewtwo = (textview) c...

if statement - Javascript expression shortage: value? value:'100' -

is there shorter way write expression value? value:'100' the way don't type value twice? something (but wrong) value? : '100' //take value unless empty/null/false/undefined/0, otherwise accept '100'. or, whatever possible fine. you can use logical or operator : value || '100' it'll return value if it's truthy ( !!value === true ), else '100' .

jquery - plugin to conver 2D image into .STL format -

is there plugin in jquery convert 2d image .stl file format ?i searched on .net not getting satisfying answer. please name plugin or other in jquery can used convert image .stl format ?? thanks, i'm not sure how can print 2d image, need 3d image print. create 3d image pretty 1. create copy of triangles, change "z" coordinate else. 2. connect 2 planes together. need know edges of 2d image.

html - set autocomplete off in jquery modal dialog -

i want set autocomplete off each , every jquery modal dialog. don't want going through every single modal dialog , set attribute false. i'm wondering there generic event can fire after modal dialog initialised? turned off autocomplete in html forms using following code in document.ready function. doesn't work jquery modal. i'm looking similar. jquery(document).ready(function($) { $(this).find(":input[type=text]").each(function () { $.setautocompleteoff(this); }); }); try catch dialogcreate event: $( window ).on( "dialogcreate", function(event, ui) { //do need }); like in fiddle: http://jsfiddle.net/brg9a/1/

javascript - Manage node-postgres query -

i've read through node-postgres’s api documentation. it recommended use pg object create pooled clients. , in pg.connect api documentation said: the connect method retrieves client client pool, or if pooled clients busy , pool not full, connect method create new client passing first argument directly client constructor. so according recommendation, using pg.connect mean "using pg object create pooled clients"? if it's not, mean? and in implementation example, made several queries in route: app.get('/post', function(req, res) { pg.connect(dbconfig, function(err, client, done) { client.query('select * post', function(err, result) { res.render('post/list', { posts: result.rows }); }); }); }); app.get('/post/new', function(req, res) { res.render('post/new'); }); app.post('/api/v1/post', function(req, res) { var b = req.body; pg.connect(dbconfig, function(err, client, done...

javascript - Is it possible to embed a custom font on to your site/install it on your host? -

i've researched fair bit , answer i've found there limited number of web fonts available seems bit old fashioned me. not possible upload custom font web host , use javascript (or else, forgive ignorance , noobishness) read custom font when visitor comes site doesn't matter don't have custom font installed it's loaded off site? you can embed custom fonts using css. @font-face { font-family: 'mywebfont'; src: url('webfont.eot'); /* ie9 compat modes */ src: url('webfont.eot?#iefix') format('embedded-opentype'), /* ie6-ie8 */ url('webfont.woff') format('woff'), /* modern browsers */ url('webfont.ttf') format('truetype'), /* safari, android, ios */ url('webfont.svg#svgfontname') format('svg'); /* legacy ios */ } body { font-family: 'myfontfamily', fallback, sans-serif; } source: css-tricks.com

javascript - msDropDown child shown only by 3px on the first click -

i've problem msdropdown plugin, seems work when click first time on it, child box options appears 3px. second click, works fine. i'm using chrome, jquery 1.9.1 , msdropdown 3.5.2 this worked me .ddchild, .ddchild ul {height:auto !important; max-height: 150px !important;} source: https://github.com/marghoobsuleman/ms-dropdown/issues/88

c# - MVC Application hosting as a sub folder -

Image
we have existing silverlight application within use "role provider" setting permission each available folders browsing. typically, requirement this: i have developed mvc application inturn should placed *as folder inside existing silverlight website * . i can able browse folder want application launched when browse folder. below, thanks in advance. right click on silverlight website , press add application button. setup mvc application , appear inside silverlight website .

javamail - email - a correspondence id -

in our upcoming application conducting email correspondence our customers. emails being sent \ received within our application ui. (we have office admin gui , can see incoming emails , reply through admin gui) a problem encounter is: when send email our customer keeping metadata of correspondence in our database. what want identify replies customer continuation email of original correspondence (so can query correspondence metadata db further processing) how can identify these emails part of root correspondence? thought injecting unique id each email being sent client correspondence id if customer feel changing or deleting problem. there other alternative? p.s thought keeping message_id of email we're sending correspondence id. works great since reply-email's header contains reply message_id. the reason wont work using 3rd party company manage our email sending (silverpop) , api wont allow message_id each mail send. any info help. thanks! a common tec...

internet explorer - Using javascript to set cookie in IE -

document.cookie= "cookiename=cookievalue; expires=mon,12jun2015:00:00:00; path=/;" i run script on internet explorer 10 doesn't share cookie between 2 ie tab. when remove "expires" properties seem working : document.cookie= "cookiename=cookievalue ;path=/;" but don't want remove "expires" properties. how resolve problem ? i have used code since mid '90s - has worked in browsers on platforms far include file , use setcookie("name","value",expirydate,"/"); // cookie.js file var cookietoday = new date(); var expirydate = new date(cookietoday.gettime() + (365 * 86400000)); // year /* cookie functions bill dortsch */ function setcookie (name,value,expires,path,thedomain,secure) { value = escape(value); var thecookie = name + "=" + value + ((expires) ? "; expires=" + expires.togmtstring() : "") + ((path) ? "; path=...

javascript - Regex Expression to allow underscore,hyphen and '&' symbol -

regex expression allow alphanumeric , special characters '-','_','&' only. have tried regex not working ! var testexp=/^[a-za-z0-9-_&]+$/; you need put - @ end (or @ beginning) of class if want considered real char : /^[a-za-z0-9_&-]+$/ you use shortcut \w , same [a-za-z0-9_] . thus: /^[\w&-]+$/

ajax - Jquery Loading an eq(i) from an external html possible? -

i load data external html file div. match eq number of external .sbool div internal .kontrollwert div, don't know how adress external div .eq() method. using .load('variable.html .sbool'.eq(i)) does not work. there way result? this have: var kontrollwertmenge = $('.statusbezeichnung').length; (i=0;i<kontrollwertmenge;i++) { $('.kontrollwert').eq(i).load('variable.html .sbool'); } for (i=0;i<kontrollwertmenge;i++) { $('.kontrollwert').eq(i).load('variable.html .sbool:eq('+i+')'); }

Display a list of items in a grid in JSF 1.1 -

i need display list of items in grid using jsf 1.1 , tomahawak. i tried this <h:panelgrid columns="4"> <h:datatable value="#{globaltvchannelsbean.filteredchannels}" var="channel"> <h:column><h:outputtext value="#{channel.channelname}" /></h:column> </h:datatable> </h:panelgrid> and this <h:panelgrid columns="4"> <c:foreach items="#{globaltvchannelsbean.filteredchannels}" var="channel" <h:outputtext value="#{channel.channelname}" /> </c:foreach> </h:panelgrid> but both not working. see problem, or suggest correct way of doing it. you need closer on how datatable component works. datatable generates html table you. in case, need use ui:repeat loops on array without creating html table tags. <h:panelgrid columns="4"> <ui:repeat value="#{globaltvchannelsbe...

datetime - PHP change the date to Y-m-d H:i -

this question has answer here: convert 1 date format in php 12 answers what require how can convert 2013-07-26t10:00:00.000+05:30 y-m-d h:i:s format. i need 2013-07-26 10:00:00 this. . what tried $datetime = datetime::createfromformat(datetime::iso8601,2013-07-26t10:00:00.000+05:30); echo $datetime->format('y-m-d h:i:s'); and $datetime = datetime::createfromformat(datetime::iso8601, srtotime(2013-07-26t10:00:00.000+05:30)); echo $datetime->format('y-m-d h:i:s'); note: the date obtained google calendar's event start , end date. use datetime $date = new datetime('2013-07-26t10:00:00.000+05:30'); echo $date->format('y-m-d h:i:s');

visitor - boost::python::class: programatically obtaining the class name -

i using templated vistors define unified interface several classes. purposes of definint __str__ , __repr__ methods, programatically obtain class name (the "x" in referenced documentation) boost::python::class object. possible? it easy work around passing class name argument visitor's constructor, having automatically more elegant. boost::python::class_ derives boost::python::object , possible query __name__ attribute class object. here simple example: #include <boost/python.hpp> class x {}; boost_python_module(example) { namespace python = boost::python; python::object x_class = python::class_<x>("x"); // extract class' __name__ attribute, printing whatever passed // class_ constructor. std::cout << boost::python::extract<std::string>(x_class.attr("__name__"))() << std::endl; } and output: >>> import example x to expand upon approach, visitor deriving ...

JAVA - saving excel (office 2010) without format warning -

i have write data in excel file. when i'm opening excel file data, teher appears warning: `the file trying open, 'name.xls', in different format specified file extension. verify file not corrupted , thrusted source before opening file. want open file now?` i'm using microsoft excel 2010. , when i'm creating httpservletresponse response i'm adding such information header , content type: response.setcontenttype("application/vnd.ms-excel"); response.setheader("content-disposition", info file name + ".xls\""); i have tried set header like: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet , file format .xlsx , doesn't because warning still appears. when i'm trying use .csv or .xml format, don't have problem, because no warning appears. there possibility programmatically rid of warning? the file trying open, 'name.xls', in different format specified file extension... ...

sql server 2008 - How to consume TDatasource Component by coding returned through delphi webservice in a delphi VLC Form -

i have made cgi web service. code below: unit myservicesimpl; interface uses soap.invokeregistry, system.types, soap.xsbuiltins, myservicesintf, data.db, data.sqlexpr, sqlconnection1, data.win.adodb; type { tmyservices } tmyservices = class(tinvokableclass, imyservices) public function testfunction(): tadodataset; stdcall; end; var connstring: string; objtadoquery: tadoquery; objtsqlds: tdatasource; objds: tadodataset; objtable :tadotable; implementation function tmyservices.testfunction: tadodataset; var objtsqlconnection1: tadoconnection; var constr: string; begin objtsqlconnection1 := tadoconnection.create(nil); constr := 'provider=sqloledb;' + 'data source=kays-serv64-01;' + 'initial catalog=test;' + 'user id=sa;password=kays@india'; objtsqlconnection1.connectionstring := constr; objtsqlconnection1.loginprompt := false; objtsqlconnection1.connected := true; if (objtsqlconnection1.connected...

iphone - Quickblox, chat room does not sends push notification -

i created chat room in quickblox, when sends message chatroom offline users not push notification. to send message : [[qbchat instance] sendmessage:@"hey! did see last liverpool match?" toroom:liverpoolfansroom]; is there doing wrong or not enabled on quickbolx server sends notification on chatroom's offline users. thanx push messages not sends automatically. if know recipient user's id can send push message manually - should call method provided below: [qbmessages tsendpushwithtext:@"text" tousers:(int)userid delegate:nil];

Can we manually add one entry into dynamic drop down list, If then how in Ruby On Rails -

i have student, student_parent , address_detail table want add student , it's parent(father , mother) address in address_detail table, have folowing relation between tables student:- has_many :student_parents has_many :address_details student_parent: belongs_to :student has_many :address_detail address_detail: belongs_to :student belongs_to :student_parent in address_detail form have drop down father , mother want add student entry manually how can do, here my address_detail form `` <%= simple_form_for @address_detail, :html => { :class => 'form-horizontal' } |f| %> <div class="control-group"> <label class = "control-label"> address correspond <abbr title="required">*</abbr></label> <div class="controls"> <%= f.collection_select(:student_parent_id, student_parent_relation_collection , :id, :relation_to_student, {:prompt => true}, :required =>true )...

matlab - Is there a convenient way of turning an existing structure into a script? -

i have existing structure array loaded workspace load() statement. fields contain char , double . i want create structure, including contents of fields, in script instead, structure large, don't want write fields , values out hand. dragging structure fields workspace editor copies field names over. is there easy , convenient way extract fields , values, fields of structure array example_struct are turned statements of form example_struct.field1 = <some_value>; which doesn't involve writing script? edit: want write script (an m-file) populates new structure array actual values. want statements script, including values, out of existing structure have loaded load() , want know if can done without writing script (say, using fprintf statements) perform task. if understand correctly, want dump struct matlab script file, rather .mat file. can few lines of matlab: fid = fopen('outputfile.m'); names = fieldnames(example_struct); = 1 : le...

button - How can I change style of PushButton in Installshield? -

i created custom dialog in basic msi project , placed 3-4 pushbuttons on it. want change pushbutton style - example want have oval buttons instead of rectangular, want have possibility of changing color, want add small image on etc... set of push button properties limited can see - there height, width, visible, tabstop textstyle , other simple properties. how can in installshield professional edition? the ui available windows installer not capable of that. we're moving direction in our advanced ui project's ui, offer relatively standard buttons @ point.

c# - Incompatible Data Reader -

using mvc 4 ef 5x , new them. my entities , contexts etc created automatically in vs 2010 existing database when try result through raw sql query getting error: the data reader incompatible specified 'platinummodel.sales_journal'. member of type, 'line_no', not have corresponding column in data reader same name. the stack exchange solutions related error ( the data reader incompatible . member not... ) have suggested error caused when there missing column or model edmx needs updating (which have done although there no need database has not been altered) sales_journal.cs - part of platinum.tt file namespace ppos_mvc_site.models { using system; using system.collections.generic; public partial class sales_journal { public int line_no { get; set; } public nullable<system.datetime> date_time { get; set; } public nullable<byte> workstation_no { get; set; } public nullable<short> user_no { get; ...

android - Posting JSON using http , fedup and failed -

i have used around 5 ways post json data http request url isn't getting fruitfull ,its not posting json formatted want , following in json want send , im successfull sending using html: here's json want: {"x":"n","y":"55"} here's working html code: <html><head><script> function sendform(form) { // construct json string in form.value // x string ('cos of quotes) // y integer ('cos of no quotes) form.value.value = "{ \"x\": \"" + form.example1.value + "\", \"y\": " + form.example2.value + " }" form.submit(); } </script></head> <body> <form action="https://api.winv.com/v1/4bhj/306adk" method="post"> <input type="hidden" name="value"> string:<input type="text" name="example1"> number:<input type="text" name=...

Could not resolve com.android.tools.build:gradle:0.5.+ -

i trying build project in android studio. project uses gradle. at time, maven.org experiencing problems , following errors: gradle: problem occurred configuring project ':myproject'. > not resolve dependencies configuration ':myproject:classpath'. > not resolve com.android.tools.build:gradle:0.5.+. required by: android:myproject:unspecified > not head 'http://repo1.maven.org/maven2/com/android/tools/build/gradle/0.5.4/gradle-0.5.4.pom'. received status code 503 server: service temporarily unavailable it made me think don't want depend on maven.org , internet connection builds! is there way drop these dependencies , make android studio self-sufficient? able build android projects without internet connection , if maven.org never recover. edit: if understand right, there way setup local maven repository , use repositories { mavenlocal() } instead of repositories { mavencentral() } in build.gradle files. unfortun...

terminology - What's a context in asp.net mvc4 -

what's context in asp.net mvc4? loads of classes use term. dbcontext, httpcontext , on. think if know meaning word have better understanding of asp.net mvc. i feel http://dictionary.reference.com/browse/context defines word 'context' applies , indeed in specific context (forgive me) refer, particularly 2: set of circumstances or facts surround particular event, situation, etc. consider classes model of "set of circumstances or facts" surrounding particular event occuring, e.g db operation or http request. dbcontext represents given context pertinent database. is, 1 might interface database in context of "reporting" or in context of "migration", or 1 might consider each interaction database seperate context last. similarly 1 might make use of http protocol in several different contexts. each use of protocol may constitute different context, i.e 1 context per request. or may refer context in utilised i.e persistence or ...

mysql - Delete records from table if table exists -

i have lot of delete queries in production databases table not found. need simple decision on problem. queries like delete b.* `table` b join `another_table` u on u.key2 = b.key u.key3 <> ? i need like: if table `table` exists delete b.* `table` b ... if need delete rows of table if latter exists, have rely on custom stored procedure think. that: -- define procedure create procedure delete_if_exists(in tbl char(80)) begin if @tbl in (select table_name information_schema.tables table_schema = "db_2_44afb7") set @query = concat("delete ", @tbl); prepare stmt @query; execute stmt; end if; end // -- use call delete_if_exists("mytable"); call delete_if_exists("myothertable"); see http://sqlfiddle.com/#!2/2ee190/3 example. of course, adjust "delete from",... part fit specific needs.

google analytics - Make sure the Android application was installed from Play-Store -

i've discovered blackmarket application, rip of google play-store apps, these people take paid app play-store , let users download , use free. as developer plan on charging buck app, bothers me, , make sure application installed via play-store, or whatever store approve of. i guess way verify sort of thing via campaign tracking, since google analytics v2, tracking of campaign done in receiver in jar. is there other way determine origin of installation of app? there way intercept campaign tracking data? thanks. check link here . then packagemanager pm = getpackagemanager(); string installationsource = pm.getinstallerpackagename(getpackagename()); when installed marked, installationsource return com.google.android% or com.android.vending% . changes , have maintain (support) in case of change - otherwise return null (from debugger) or other package name, other application (the undesired ones :))

Sass using @extend % from within a partial css file -

i have style.scss imports _declarations.scss _button.scss in _declarations.scss, have placeholder declaration of %blah{ colour: red; width: 100%; } inside style.scss, can have selector this .extend_it{ @extend %blah; } and styles i'd expect pulled .extend_it selector. however if try same within _button.scss unable extend %blah placeholder. is there way around this?

python - Variable inputs within an IF creating a bank. -

i'm new python , doing work if statements. have far... print("hello") myname = input("what name?") print("hello " +myname) myage = int(input("how old you?")) if myage <=18: myresponse = input("you must still @ school?") if myresponse == "yes" or "yes" or "yes" or "y" or "yes" or "y": myschool = input("what school go to?") print (myschool, "that school hear") if myresponse == "no" or "n" or "n" or "no": print("lucky you, have lots of free time!") if myage >=19: myresponse = input("you must have job?") if myresponse == "yes" or "yes" or "yes" or "y" or "yes" or "y": mywork = input("what do?") print (mywork, "thats tough job") if myresponse == ...

ruby - How to replace 'nil' with a value using sub -

i trying substitute nil value using sub isn't happening. wrong. a="" a.sub!(//,"replaced") puts #=> "replaced" b=nil b.to_s.sub!(//,"replaced") #tried => (b.to_s).sub!(//,"replaced") didnt work puts b #=> nil what missing? to understand happening, let's follow code statement statement: a="" # create new string object (the empty string), assign a.sub!(//,"replaced") # sub! changes string object puts #=> "replaced" # changed string printed b=nil # assign nil b b.to_s.sub!(//,"replaced") # 2 steps # nil.to_s creates new string object "" (the empty string) # .sub! modifies new string object in place # edited string not assigned anything, garbage collected later puts b #=> nil # b still assigned nil we ...

asp.net - Export Excel from grid not working on Ajax Model PopUp -

hi trying export grid data excel not working in ie8.i using ajax modal popup dialog box containing 2 buttons 'ok' , 'close'.on ok click want download excel file.it works fine in mozilla in ie not working.i using below code. please suggest me how that?also when open file first show warning before opening file how handle that? response.clear(); response.buffer = true; string filename = "checkout"; response.charset = ""; response.contenttype = "application/vnd.ms-excel"; response.addheader("content-disposition", "attachment; filename=" + filename + ".adt"); response.write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">"); response.write("<head>"); response.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"); response.write("<!--[if gte mso 9]...

c++ - magick++:cut out a image to a new image -

i want cut out image , save in new image. new image written file right, printed pixels wrong. why? magick::image cutout(magick::image & image, point const & pos, size_t width, size_t height) { size_t const buffersize = width*height*3*sizeof(char); std::unique_ptr<char[]> buffer(new char[buffersize]); image.write(pos.x, pos.y, width, height, "rgb", magick::charpixel, buffer.get()); magick::image res(width, height, "rgb", magick::charpixel, buffer.get()); return res; } magick::image cutoutdigit(magick::image & image, fixestype const & fixes, point const & pos) { point lt = transform(fixes, pos); point rb = transform(fixes, point(pos.x+digitwidth, pos.y+digitheight)); auto newimage = cutout(image, lt, rb.x-lt.x, rb.y-lt.y); magick::geometry g(digitwidth,digitheight); g.aspect(true); newimage.resize(g); return newimage; } void print(magick::p...

python - extract price from html tag -

this question has answer here: regex match open tags except xhtml self-contained tags 35 answers <dt class="col2"> <p>rs. 2691.00 </p> </dt> from above html code,i need extract price using regular expressions.i used beautifulsoup parsing. can propose regular expression above? if you're trying "2691.00" use: (?<=rs\.)\s*(\d+\.\d{2}) most regex engines can't * in lookbehind, make dynamic enough not fail if there's more 1 space left in main group. can either use main match , trim off excess spaces or use capture group 1. (?<= ) positive lookbehind. tells regex engine whatever inside of has matched before main matching group, don't include in match. rs\. matches "rs.". in regex . character matches have escape match period. \s matches spaces. * matches between 0 , inf...

c# - Switching between viewmodels -

my wpf application has 3 models , each has own viewmodel & view. how switch between these views on main window based on menu selection? switching vms not route go due data binding. each page should have own vm. doesn't mean can't share vms though. have main page vm have each other vm, when switch, take change account data bindings.

c# - How to determine the sender of a delegated email in Exchange 2010 -

i trying find way name of sender of item in delegated mailbox in exchange 2010 via exchange web services. scenario many delegates have access shared inbox , send emails inbox owner (i.e. 'messagingtest@onetwothree.com') able identify sent particular email. i can hold of sent folder items fine can't find way of identifying sender. exchangeservice service = new exchangeservice(exchangeversion.exchange2010_sp2); service.credentials = new system.net.networkcredential("administratorusername", "administratorpassword", "onetwothree"); service.url = new uri("https://excas.onetwothree.local/ews/exchange.asmx"); service.autodiscoverurl("exadmin@onetwothree.com", redirectionurlvalidationcallback); mailbox principal = new mailbox("messagingtest@onetwothree.com"); folder ftest = folder.bind(service, new folderid(wellknownfoldername.sentitems, principal)); finditemsresults<item> findaltresults = service.finditems(...

ios - Cropping ImageView in the Shape of Another ImageView -

how can crop imageview bubble shape have image in project. following simple code resizing or crop image, need pass height or width image want: for croped image: uiimage *croppedimg = nil; cgrect croprect = cgrectmake(as need); croppedimg = [self croppingimagebyimagename:self.imageview.image torect:croprect]; use following method return uiimage ( as want size of image ) - (uiimage *)croppingimagebyimagename:(uiimage *)imagetocrop torect:(cgrect)rect { //cgrect croprect = cgrectmake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height+15); cgimageref imageref = cgimagecreatewithimageinrect([imagetocrop cgimage], rect); uiimage *cropped = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); return cropped; } here croped image return above method; or resizing and use following method specific hight , width image resizing uiimage : + (uiimage*)resizeimage:(uiimage*)image withwidth:(i...

basic authentication with http post params android -

i doing basic authentication passing username , password , using basicnamevaluepair sending post params response service. my method: public stringbuilder callservicehttppost(string username, string password, string type) { // create new httpclient , post header httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(webservice + type); httpresponse response = null; stringbuilder total = new stringbuilder(); try { url url = new url(webservice + type); /*string base64encodedcredentials = base64.encodetostring((username + ":" + password).getbytes(), base64.url_safe | base64.no_wrap);*/ string base64encodedcredentials = "basic " + base64.encodetostring( (username + ":" + password).getbytes(), base64.no_wrap); httppost.setheader("auth...