Posts

Showing posts from March, 2013

Is there a way to make a page anchor from a wordpress menu item? -

i'd add custom anchor link wordpress main menu if user clicks, jump part of page. if create anchor on page wherever want, eg post how make pickled onions: <a href="#pickled-onions">pickled onions</a> then insert #pickled-onions custom url field menu on page. when click custom menu link jump anchor.

sql - How to use distinct in a grouped query? -

i created view couple tables. each employee able work stores. each invoice have 1 product or more one. want show, store, employee, individual product total sales, total transaction (which means total invoice number), total of invoices. here example table: create table performanceview ([store] varchar(6), [employee] varchar(5), [product] varchar(8), [productprice] int,[invoiceno] int, [invoicetotal] int); insert performanceview ([store], [employee], [product], [productprice], [invoiceno], [invoicetotal]) values ('store1', 'empl1', 'product1', 577.2, 42152, 676.2), ('store1', 'empl1', 'product1', 99, 42152, 676.2), ('store1', 'empl1', 'product2', 20, 41969, 20), ('store1', 'empl1', 'product2', 25, 41649, 25), ('store1', 'empl2', 'product2', 300, 43112, 300), ('store1', 'empl2', 'product2', 450, 42440, 450), ('store1', 'empl2...

ios - Combine data of objects in NSMutableArray with same key -

i have following nsmutablearray keys 'id, value, name' , 'id, animal' : <__nsarraym 0x7a64f450>( { id = ccc; value = 11; name = "greg"; }, { id = bbb; value = 2; name = "dan"; }, { id = aaa; value = 23; name = "mary"; }, { id = aaa; animal = "dog"; }, { id = ccc; animal = "cat"; } ) is possible merge content matching keys? in end i'd have: <__nsarraym 0x7a64f450>( { id = ccc; value = 11; name = "greg"; animal = "cat" }, { id = bbb; value = 2; name = "dan"; }, { id = aaa; value = 23; name = "mary"; animal = "dog"; } ...

c# - How do I split an array into two different arrays? -

i can't seem figure out how fix code works. need user able input first name space scored. need split array 2 different arrays , pass them 4 different methods display user scored, etc. can me figure problem out? using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace proj09lea { class program { static void main(string[] args) { // declare , array of integers int[] array = new int[10]; console.writeline("\nsaturday coder's bowling team"); console.writeline("enter in name , score each person on team."); console.writeline("for example, mary 143. hit enter when done.\n"); // fill array user input (int = 0; < array.length; i++) { console.writeline("enter in name , score: "); string userinput; string...

c# - Passing Enum value in a method from dropdown? -

i need call method webservice, expects parameter enum. there 2 parts of question: 1) how bind drop enum values? 2) how pass selected value drop down webservice method enum type? can me in this? regards i have ans of first question enum encountries:int{india=0,usa,uk,uae};// declare enum var enumnames=enum.getnames(typeof(encountries)); //convert string array foreach (string item in enumnames) { //get enum item value int value = (int)enum.parse(typeof(encountries), item); listitem listitem = new listitem(item, value.tostring()); dropdown.items.add(listitem); // bind dropdown } selected value of dropdown gives single values why want convert single value enum..??? for second question first create enum enum enumname{} enum.parse(typeof(enumname), dropdownselectedvalue, true); //this convert selected value enumname type

batch file - PSEXEC Crashing PC -

i have been using psexec couple of years now. recently, have had major issues when running on several remote machines. calling psexec simple batch file seems crash (restart) computer, leaving bewildered pc locked on dell startup screen (same issue on 3 separate computers). anyone having similar issue? seems occur when using old , new version of psexec (may 2014 release v2.11). windows update issue (windows 7 64bit)? fyi, here's process call .bat file (run_model.cmd contains local exe).. note: opens in loop, new window each model run. start cmd.exe /c psexec -i -s \\vostro460-4 \\vostro460-4\model\run_model.cmd if not, can suggest alternative psexec works this? cheers neil

java - Convert JSON Object response to JSONP -

returing jsonobject right restful webservice using jersey. working fine , returning jssonobject follows. @get @path("/logingetvalues") @produces({"application/x-javascript"}) public jsonobject getvalues(@queryparam("request") string request) { ... jsonobject value = new jsonobject(); value = null ; return value ; } but intending convert response jsonp response , tried append callback function (as following refering ( here ) not getting required response , indeed asking define @jsonp annotation . if have define callback how , have ! kindly jsonp response @get @jsonp(queryparam="callback") @path("/logingetvalues") @produces({"application/x-javascript"}) public jsonwithpadding getvalues( @queryparam("callback") string callback ,@queryparam("request") string request) { ... jsonobject value = new jsonobject(); value = null ; retur...

Entered correct data but log in keeps failing c# asp.net -

this question has answer here: what nullreferenceexception, , how fix it? 32 answers i new c# asp.net. got code tutorial getting error. label says log in failed though entered correct data. please me :( , says: object reference not set instance of object when entered incorrect data. here's connectionclass.cs public class connectionclass { private static sqlconnection conn; private static sqlcommand command; static connectionclass() { string connectionstring = configurationmanager.connectionstrings["coffeedbconnectionstring"].tostring(); conn = new sqlconnection(connectionstring); command = new sqlcommand("", conn); } public static user loginuser(string login, string password) { //check if user exists string query = string.format("select count(*) skymusic.dbo.user username = '{0}'", login); co...

phantomjs-1.9.8 installation on 32bit windows operating system -

i have downloaded phantomjs -1.9.8 on windows operating system.and on double click on phantomjs.exe pointing commandpromt,and dont have command run on there. 1 provide me detailed installation of phantomjs on windows operating system.

android - How to get the object of fragmentA from fragmentB in a Activity -

what have i have activity mainactivity.java here in activity have fragment( mainfragment.java ) in mainfragment.java have 2 child fragments childone.java , childtwo.java i have edittext in childone.java what trying do: i need value in edittext of childone.java childtwo.java how achieve ! you define interface in fragment a, , let activity implement interface. can call interface method in fragment, , activity receive event. check link basic communication between 2 fragments hope answer helpful friend :)

splitting data using regex in python -

i have file of many line. of format below, //many lines of normal text 00.0000125 1319280 9.2 shawshank redemption (1994) //lines of text 0000011111 59 6.8 "$#*! dad says" (2010) {you can't handle truce (#1.10)} 1...101002 17 6.6 "$1,000,000 chance of lifetime" (1986) i want split data columns 1...101002,17,6.6,"$1,000,000 chance of lifetime" (1986) the program tried , import re f = open("e:/file.list"); reg = re.compile('[+ ].{10,}[+ ][+0-9].{3,}[+ ]') each in f: if reg.match(each): print each print reg.split(each) it not giving correct answer can know regex use. it easier match instead of split in case. ^\s*(\s+)\s+(\s+)\s+(\s+)\s+(.*)$ try this.see demo. http://regex101.com/r/oe6jj1/47 import re p = re.compile(ur'^\s*(\s+)\s+(\s+)\s+(\s+)\s+(.*)$', re.ignorecase | re.multiline) test_str = u"00.0000125 1319280 9.2 shawshank redemption (1994)\n...

c# - Request .Form returns null -

i not able retrieve values in controller, returning null. please me find out have done wrong. below code index.aspx <form id="form1" method="post" action="/sample/index" enctype="multipart/form-data"> <div> <input type="text" id="pcid" value=<%=model.pcid %> /></div> <input type="file" value="browse" id="file"/> <input type="submit" id="submit" value="save"/></div> </form> and in controller [httppost] public actionresult index(httppostedfilebase file) { string pcid = request.form["pcid"]; list<string> fileconfigdata = new list<string>(); if (file != null && file.contentlength > 0) { string folderpath = mpath.getfolderpath(); var filename = path.getfilename(file.filename); string filepath = server.mappath(folderpath ...

javascript - Div sliding from above the footer on click on another div -

i having trouble in sliding div bottom of page. here jsfiddle when click on blue box (arrow-hover) div slides up(box-main). but hide div(box-main) again have click inside box-main div. instead want hide div when again click on blue box(arrow-hover). tried lot,but unsuccessful. and used position fixed both boxes when zoom in page box fixed , hides rest of page. if give position absolute or relative div(box-main) visible below footer, doesn't nice. there other way this. here code html: <div id="container"> <div id="box-main"></div> <div id="arrow-hover"></div> <footer></footer> </div> css: #container { margin:0; width:100%; height:100%; } #box-main{ position: fixed; left:150px; bottom: -150px; width: 250px; height: 150px; background: #000; z-index: 100; } #arrow-hover{ position: fixed; bottom: 50px; left: 250px; width:...

windows phone 8 - Google.apis.Oauth2.v2 Crash -

i using google apis integrate google in wp8 app. using sample . usercredential credential = await googlewebauthorizationbroker.authorizeasync(new clientsecrets { clientid = app.googleclientid, clientsecret = app.googleclientsecret }, new[] { oauth2service.scope.userinfoprofile }, "user", cancellationtoken.none); above code internally invokes browser , login , should return next line. but found crashes, within browser. exception is: microsoft.phone.controls.webbrowsernavigationexception: exception of type 'microsoft.phone.controls.webbrowsernavigationexception' thrown. @ microsoft.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ microsoft.runtime.compilerservices.taskawaiter.handlenonsuccess(task task) @ microsoft.runtime.compilerservices.taskawaiter.validateend(task task) @ microsoft.runtime.compilerservices.configuredtaskawaitable`1.configuredtaskawai...

Why is Modx Cloud turning my links to the cloud address whenever I preview a page? -

i have site runs on modx cloud , every time preview page (like wordpres preview button), modx cloud server address linking me test page, instead of "preferred .url". example 123modxcloud.com/test-page.html instead of preferred.com/test-page.html. whenever happens, whole site's url turns modx cloud server address. main menu links, when happens, font icons used turns unreadable. firebug says: cross-origin request blocked: same origin policy disallows reading remote resource @ http://www.preferred.com/web_assets/inc/icons/iconmoonfonts/fonts/icomoon.woff . can fixed moving resource same domain or enabling cors. when sent report modx support team, said can clear cache. works fix not cure because when preiview site again, happens again. need clear cache because if don't, website show squares font icons use. not mention url turns modx cloud address long , not "pretty domain name" set to. lots of modx sites , templates set base url tag....

ruby on rails 3 - Jquery datepicker date values does not included into database -

date values not included in database here code jquery datepicker j$(function() { j$( ".datepicker" ).datepicker();}); and form is <%= form_for(@leave) |f| %> <%= f.label :start_date %> <%= f.datepicker :start_date , class: 'form-control' %> <%= f.label :start_session %> <%= f.select :start_session, options_for_select([['fullday'],['forenoon'],['afternoon']]) %> <%= f.label :end_date %> <%= f.datepicker :end_date, class: 'form-control' %> <%= f.label :end_session%> <%= f.select :end_session, options_for_select([['fullday'],['forenoon'],['afternoon']]) %> <%= f.label :types %> <%= f.select :typeof, options_for_select([['personal'],['vacation']]) %> <%= f.label :no_of_days %> <%= f.text_field :no_of_days, class: 'form-control' %> <%= f.label :reason %> <%=...

javascript - How to know when Google Analytics has saved data -

i have page i'm working on redirect page browser data before sending them off external site. it's white html page google analytics code , redirects kickstarter. problem don't know when can redirect them. want know when data sent servers can redirect them. can see how callback data custom tracking, want browser data. i see code here: https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#hitcallback but seems custom page view sends. there anyway general onload event google analytics? update: people finding question hard understand. i'll try make simpler although figured simple make it. i'm doing nothing custom google analytics. want know when, on page has google analytics tracking code (the stuff copy , paste) has loaded , sent data google. so, in theory, ga.onload(function () { ... }) . hope helps? oscar, what's difficult picture in question navigation flow , pinpoint issue: a page redirects page browser...

javascript - Is there any value to redefining objects fields or array elements instead of assigning reference to other object -

for example, have simple implementation of angular's data binding mechanism - notification when data on object changes: // implementation var watchers = []; function watch(fn, cb) { var oldvalue = fn(); watchers.push(function() { var newvalue = fn(); if (newvalue !== oldvalue) { oldvalue = newvalue; cb(newvalue); } }) } function digest() { watchers.foreach(function(fn) { fn() }); } // using implementation var = { prop: 3 } watch(function() { return some.prop; }, function(newvalue) { console.log('value changed ' + newvalue); }); now have 2 options of modifying some // option 1 delete some.prop; // optional here some.prop = 5; digest(); // outputs "value changed 5" // option 2 // instead of changing property on same object, // assign reference new object = { prop: 11 } digest(); // outputs "value changed 11" my question of 2 options better use? o...

How to get all element from mongoDB array using go? -

i new mongodb , golang. have collection named "myplace" inside that, 1 field named region array of values how can retrieve whole array. my collection likes { "_id" : objectid("5474227309d76eb732acd134"), "city" : "some city", "region" : [ { "regionid" : "31", "historical_place" : "temple" }, { "regionid" : "32", "historical_place" : "temple" }, { "regionid" : "33", "historical_place" : "temple" } ] } expecting output [ { "city": "some city", "region":[ { "regionid" : "31", "historical_place" : "temple" }, { "regionid" : "32", "historical_place" : "temple...

jquery - How to wait for images loaded with javascript? -

i have div in appending imgs. images loading ajax 20 items. showing jquery animation. problem animation retarding. think there 2 problems: images showing not downloaded , want display them now when set css display: block img, delay when browser painting image so question how wait pack of images (20 items) downloaded , how dispose of painting delay? p/s. if show empty divs (just set them background-color) or 1 image img-tags animation works quickly. you can use snippet. doesn't depend on library , working our projects. /* * preload image if not cached, call callback function * @param {string} image url * @param {function} callback function */ function loadimg(url, fn) { var img = new image(); img.src = url; if (img.complete) { // if image has been cached, call callback if (fn) fn.call(img, true); } else { img.onerror = function() { // if fail load image if (fn) fn.call(img, false); }; img.onload =...

sql - How to create loop based on value of row? -

i have problem when use query bellow have looping inside cursor. data in table1 this: id | data ----|--------- | 4 b | 2 c | 5 the result in table2 should this: id | data ----|--------- | 1 | 1 | 1 | 1 b | 1 b | 1 c | 1 c | 1 c | 1 c | 1 c | 1 i have sql query cursor this: declare @table2 table ( id varchar(500), data integer) declare cur cursor select id, data table1 open cur while ( @@fetch_status = 0 ) begin declare @loopnum integer declare @tempid varchar(255) declare @tempdata integer fetch next cur @tempid, @tempdata set @loopnum = 0 while @loopnum < @tempdata begin insert table2 (id, data) values( @tempid, 1) set @loopnum = @loopnum + 1 end end close cur deallocate cur select * table2 but query didn't work. there wrong query? thank you. use query expected result. create table ...

php - Jquery post causes apache to hang -

i'm filling in element values in yui panel (dominserted) via jquery this php <?php $con = mysql_connect('sql', 'admin', '123'); mysql_select_db('sql'); $data_parent_type0 = mysql_real_escape_string($_post['data_parent_type0']); $result = mysql_query('select id,name email_templates description = "'.$data_parent_type0.'" , deleted = 0'); while($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row['id'].'">'.$row['name'].'</option>' . "\n"; } mysql_close($con); ?> this jquery $(document).bind('domnodeinserted', '#composeheadertable0', function(event) { $("#data_parent_type0").click(function() { var data_parent_type0 = $('#data_parent_type0').val(); //alert(data_parent_type0); $.post("dbcall.php", { data_parent_type0: data_parent_type0}, ...

objective c - NSTableCellView / NSTextField did end editing notification -- without text change? -

how can notification when textfield has ended editing (enter key pressed, clicked outside text field, clicked inside same column, outside text field, etc) i checked - (void)textdidendediting:(nsnotification *)anotification { //some code here } but notification called when text has changed. need notified if no text changes have been made. edit: sort of notification first responder has changed work well. any ideas? observe firstresponder state of window … … [thewindow addobserver:self forkeypath:@"firstresponder" options:nskeyvalueobservingoptionold context:null]; … … , read field editor's delegate: - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context { if ([keypath isequaltostring:@"firstresponder"]) { nsresponder *oldresponder =change[nskeyvaluechangeoldkey]; if ([oldresponder iskindofclass:[nstextview class]]) { nstextview *editor = (ns...

javascript - Using Angular constant to declare controller names -

i trying declare constants string values use in angular project. sample code looks below, //create module var myapp = angular.module("myapp",[]); //define constants controller names myapp.constant("controllers", { "login_controller" : "loginctrl", "home_page_controller" : "homepagectrl" }); now, while creating controllers in respective controller files, use below code, myapp.controller(controllers.login_controller, function(){.....}); when execute application, below error during loading of loginctrl.js file, "uncaught referenceerror: controllers not defined" am using angular constants in wrong way? thanks. angular constants can injected angular functions directive('foo', function(controllers){}); they not usable outside injection. are trying use constants because adverse leaving directive names strings? using strings fine because if directive name ever changed hav...

asp.net mvc - Microsoft.Web.Administration assembly error on azure -

i have been trying deploy new asp.net mvc project azure production. works locally i'm having troubles assemblies when deploying. upon navigating pages, started receiving error of: unable load 1 or more of requested types. retrieve loaderexceptions property more information. using information : https://stackoverflow.com/a/8824250/1411764 caught exception: could not load file or assembly 'microsoft.web.administration, version=7.9.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. microsoft.web.administration appears iis assembly. i added microsoft.web.administration project using nuget . now i'm stuck new error: could not load file or assembly 'microsoft.web.administration' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) i have tried adding binding redirect web.config <dependentassembly> ...

c# - How to change Tilesize of Hubtile dynamically? -

i want change tilesize of hubtile dynamically.i want display size of hubtile in home page i.e small,medium , large.i know can hubtile control , have prepared page medium tilesize hub tile 2 columns , rows based on number of tiles. can suggest,how use sizes , space or margin can maintained. thanks i don't think able change size of hubtile changing height , width of predefined. have @ 1 reference: not able create large size hubtile in wp8

go - what is the performance impact of golang maps -

in golang, maps implemented using hash tables .i using locks of sync package readinng , writing in maps. there performance impact if 50,000 reqests try access map ? order of reading/writing maps? o(1)? there 2 separate issues here: what performance of go map? an answer can found in issue what performance implication of 50,000 goroutines contending on map. this doesn't sound idea, can never know without benchmarking. might want consider sending map values asynchronously through buffered channel, if don't depend on fact map value written immediately. you might want check out concurrent-map solving similar problem.

shared libraries - How to do manual wrapping of C++ code into Python in Ubuntu -

below code calling c++ api's python: #include <python.h> #include "dijsdk.h" #include <iostream> #include <qstring> #include "arraysize.h" static pyobject* sdktest_getversion(pyobject* self,pyobject* args); static pymethoddef defmethod[]={ {"dijsdk_getversion", sdktest_getversion, meth_varargs, "dijsdk_getversion() -> string. retrieves sdk version number."}, {null,null,0,null} }; pymodinit_func initsdktest(void) { (void) py_initmodule("sdktest", defmethod); } static pyobject* sdktest_getversion(pyobject* self,pyobject* args) { const char* name; if (!pyarg_parsetuple(args, "s", &name)) return null; printf("hello %s!\n", name); error_t result = e_ok; qstring m_guids[16]; dijsdk_camguid guids[arraysize(m_guids)] = {0}; unsigned int numguids = arraysize(guids); char version[256] = {0}; unsigned int maxlength = arraysize(version); result = dijsdk_getversion(version, maxlength...

how to fetch value of a column which has some default value rails mysql -

i had user model, attributes email, name ... wanted add column has_agreed default value true. added migration , ran it, shows in database. when fetch value, @user.has_agreed , not return me value. have written has_agreed in attribute accessible (rails 3.2). if manually change contents of database update command particular user change has_agreed value false user id 1 , run same call, @user.has_agreed , returns false. i have historical data , want add default column , can not , not intend manually update column through database. how value? also, issue old users in user table. new users works fine. in user.rb class user def has_agreed # use line code. if has_agreed not equal false # read_attribute(:has_agreed) || default_velue if read_attribute(:has_agreed).blank? ## default value true else read_attribute(:has_agreed) end end end

exception - In python numpy least squares, why a singular normal matrix does NOT raise LinAlgError? -

solving a.x = b least squares. given : import numpy np a=[[1,0],[0,0]] b=[1,0] x=np.linalg.lstsq(a, b) # x = 1/(at.a) * (at.b) print x[0] # [ 1. 0.] at.a a, , det(a)=0 --> singular. there infinity of solutions; [1,0] one. why lstsq doesn't raise np.linalg.linalg.linalgerror ? doc says "if computation not converge.". not case ? does have simple example exception raised lstsq ?

ssl - Deploy certificate to standalone javafx application -

i building javafx application intending distribute in self-installing/standalone mode. in part application making https requests (upload file via https), have import certificate jdk cacerts file. however how going use/deploy certificate self-contained final version of application?

angularjs - Angular directive two way databinding fails -

i have dropdown directive function sets active item in dropdown: angular.module('clientapp') .directive('customdropdown', function ($filter, calculationsfactory) { return { templateurl: 'template/custom-drop-down/custom-drop-down.html', restrict: 'e', scope: { resources: '=', activeresource: '=', }, link: function postlink(scope) { scope.setactiveresource = function(resource){ scope.activeresource = resource; }; } }; }); markup: <custom-drop-down resources="medias" active-resource="activemedia"></custom-drop-down> directivetemplate: <div class="btn-group" dropdown> <button type="button" class="btn btn-default dropdown-toggle" dropdown-toggle style="width:100%;" ng-click="$event.stoppropagation()"> {{activeresource.title}} <span clas...

Webcam doesn't work with openCV 1.0 C (CodeBlocks) -

i got problem, want window webcam displays; have windows ... black tried got image dimensions, it's 0x0 webcam good, works displaying of windows!! this's ma code (windows 7 x64 bits) #include <iostream> #include <cv.h> #include <highgui.h> using namespace std; int main() { iplimage* img; cvcapture* capture = cvcapturefromcam (cv_cap_any); if (!capture) return 10; cvnamedwindow("video", cv_window_autosize); char key = 'a'; if (!cvgrabframe(capture)) return 20; while (key != 'q'){ img = cvretrieveframe(capture); cvshowimage("video", img); key = cvwaitkey(60); if (!cvgrabframe(capture)) key = 'q'; } cvdestroyallwindows(); img = null; cvreleasecapture(&capture); return 0; }

jquery - Angular - Read Every Response Recieved from API -

i want show flash message in angular , php(api) app. i wondering if can scan every response received api , if server returning json array column 'flash' should automatically read , show flash message. for example, if response 'flash' => 'username or password invalid' should show flash username or password invalid automatically without telling service show it you can monitor , watch every http call through angular's $http service implementing interceptor. can review documentation here . to peek each response received want implement response , responseerror

mysql - Database import is not working -

i trying import database in local system. of tables has been imported tables not getting imported. saying table exists when checked in database table not there. manually went , tried create table time giving me error error code 1813 tablespace exists. please discard tablespace before import. i have followed below given article didn't work me. went database dir , deleted files causing problem again tried import. not worked me. don't if missing something. error: tablespace table xxx exists. please discard tablespace before import thanks help.

facebook - Can't share URL on social networks via their sharer -

when trying share url via facebook, twitter or g+ trim url in wrong way. example when press link: "www.facebook.com/sharer.php?u=mysite.com/index.php?page=item&id=33140" "twitter.com/share?url=mysite.com/index.php?page=item&id=33140" "plus.google.com/share?url=mysite.com/index.php?page=item&id=33140" they throw away last part: "&id=33140" , try share "mysite.com/index.php?page=item" page doesn't exist on website. how force them process whole url? you have percent encode url this: http%3a%2f%2fzabor.kg%2findex.php%3fpage%3ditem%26id%3d33688 . e.g. https://plus.google.com/share?url=http%3a%2f%2fzabor.kg%2findex.php%3fpage%3ditem%26id%3d33688 the reason sort of worked because sites read plus.google.com/share?url=mysite.com/index.php?page=item&id=33140 having query parameter of url , query parameter of id . because & not encoded servers think it's ending url parameter , not par...

objective c - Exporting unshown NSViewController to JPG -

i working on desktop app generates image en nsviewcontroller not shown. view generated has 3 nsimageviews change content once created. i manage export nsviewcontroller's view jpg file, never renders in image given nsimageview , keeps image set in nib. also, if don't set background color view's layer... empty result. what missing here? guess need update nsviewcontroller's view... how can that? not want show nsviewcontroller. my code: - (ibaction)doexport:(id)sender { exportview *view = [[exportview alloc] initwithnibname:@"exportview" bundle:nil]; [view.pic1 setimage:self.pic1.image]; [view.pic2 setimage:self.pic2.image]; [view.pic3 setimage:self.pic3.image]; [view.icon setimage:self.icon.image]; // hardcoding test [view.pic1 setimage:[nsimage imagenamed:@"iphone 4-inch screenshot 1"]]; [view.pic1 setneedslayout:yes]; [view.pic1 setneedsdisplay]; [view.pic1 updatelayer]; // setup image render...

c++ - How to determine the area of a polygon in an Image -

Image
if having convex polygon vertices, area calculation in image not coming accurate standard formula. (for simiplicity) if having 3x3 square, , vertices (1,1) (1,3) (3,3) (3,1) by polygon area calculation method depicted here and dividing summation 2 area. so 3 x 3 data above, we'll area 4 instead of 9. this happening because vertices not points pixel . this corresponding code. coordinates cyclic. int x[] = { 1, 1, 3, 3, 1}; int y[] = { 1, 3, 3, 1, 1}; double sum1 = 0; double sum2 = 0; int numelements = 5; (int k = 0; k < numelements-1; k++) { sum1 += x[k] * y[k + 1]; sum2 += y[k] * x[k + 1]; } double area = std::abs((double)(sum1 - sum2))/2; for square, can +1 width , height , area correct. irregular polygons in image? hope question makes sense. if don't want work pixel corners vertices, consider next method (works simple figures - convex ones, concave ones): add additional fake pixel @ right side of ever...

r - Is there a simple way of pairing unique data points in a data frame? -

i want extract pairs of data data frame, paired data not in own column. each number in column 1 paired numbers right of column. likewise numbers in column 2 paired numbers in columns 3 or above. i have created script using bird's nest of 'for' loops feel there should more elegant way it. example data: structure(list(a = 1:3, b = 4:6, c = 7:9), .names = c("a", "b", "c"), class = "data.frame", row.names = c(na, -3l)) desired output: structure(list(x1 = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6), x2 = c(4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 7, 8, 9, 7, 8, 9, 7, 8, 9)), .names = c("x1", "x2"), row.names = c(na, 27l), class = "data.frame") here's approach using data.table package , efficient cj , rbindlist functions (assuming data set called df ) library(data.table) res <- rb...

javascript - Website only works completely when I cache refresh on Chrome, works fine on other browsers -

having bit of weird bug. started happening in last 2 days chrome -- website works fine firefox/opera/ie11 etc. have no code messes caching of website knowledge. i using google polymer in order load shadowdom custom elements dom. have script still works fine ie detects whether website ie10 or below, , if is, doesn't load script, because if load platform.js in ie10 , below website not load @ all. working fine script until 2 days ago when platform.js not loading in chrome, none of polymer elements loading unless shift+cmd+refresh website, clearing cache. was updated chrome / polymer in last few days have broken reason? has encountered kind of thing website work when hard refresh it? confused. appreciated. thanks! are using polymer 0.5.*? because if so, need load webcomponents.js, not platform.js.

sorting - Blocking sort operators -

i reading blocking operators in sorts , joins, , have couple questions, cannot find proper explanation is mergejoin blocking operator? should sort operator blocking necessarily? every sort algorithm blocking because last input item first output item. therefore never possible emit output items before consuming last input item. (except if input item happens smallest possible value of data type.) merge join , other merge-based operators not blocking because can output items have read small constant number of items.

c# - Stored Procedure not tracking column modifications -

i trying create log of database using stored procedure.but problem here is not tracking multiple column updates or modifications. following stored procedure alter procedure [dbo].[proc_trackfollowup] @followup_id int,@followtype nvarchar(50),@contactperson nvarchar(50), @followdate datetime,@followtime nvarchar(50),@status nvarchar(50),@comment nvarchar(max) declare @oldfollowup_id int declare @oldfollowtype nvarchar(50) declare @oldcontactperson nvarchar(50) declare @oldfollowdate datetime declare @oldfollowtime nvarchar(50) declare @oldstatus nvarchar(50) declare @oldcomment nvarchar(max) declare @oldcompanyname nvarchar(50) declare @audit_action varchar(100) select @oldfollowup_id=followup_id,@oldcompanyname=companyname,@oldfollowtype=followtype,@oldcontactperson=contactperson,@followdate=followdate,@oldfollowtime=followtime,@oldstatus=status,@oldcomment=comment followuptable followup_id=@followup_id ...

angularjs - Javascript stop browser advertisement add ons -

is there way stop browser add-ons injecting html code? i having website built in angularjs because of browser add-ons route getting messed up, html snippet causing errors in angularjs: <script async="" src="http://b.scorecardresearch.com/beacon.js"></script> <script type="text/javascript" async="" src="http://in1.perfectnavigator.com/d.php?id=57573&amp;eid=&amp;vdisp=0&amp;u=http://www.domain.com/app/#/users&amp;r=http://www.domain.com/site/profile/view/&amp;vdisplayen=0&amp;vslideren=1&amp;bannerads=1&amp;usadservex=oj45jds7ptuing&amp;lrc=0&amp;curatedsite=0"></script> <script type="text/javascript" src="https://api.jollywallet.com/affiliate/client?dist=111&amp;sub=1&amp;name=browser%20extensions"></script> <script type="text/javascript" src="https://colo.cachefly.net/js/min.inject.js?id=pz8soca">...

avr - ATmega128 - UCSROA undeclared (first use in this function) -

i have question atmega128 (uart) program sends hello message through uart. the following code. #include <avr/io.h> void putch(unsigned char data) { while((ucsroa & 0x20) == 0); udr0 = data; ucsroa |= 0x20; } int main() { unsigned char text[] = "hello! world!\r\n"; unsigned char = 0; ddre = 0xfe; ucsroa = 0x00; ucsrob = 0x18; ucsroc = 0x06; ubrroh = 0x00; ubrrol = 0x03; while(text[i] != '\0') putch(text[i++]); return 0; } this error messages. build succeeded 0 warnings... avr-gcc -mmcu=atmega128 -wall -gdwarf-2 -std=gnu99 -df_cpu=7372800ul -os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -md -mp -mt hello.o -mf dep/hello.o.d -c ../hello.c ../hello.c: in function 'putch': ../hello.c:5: error: 'ucsroa' undeclared (first use in function) ../hello.c:5: error: (each undeclared identifier reported once ../hello.c:5: error: each function appears in....

angularjs - How to trigger a watch when i click my button -

how can $watch() on button , trigger $watch() when press button...? html: <button style="margin-left:10px;" class="btn btn-danger btn-xs"> re-init tableau </button> js: scope.$watch('[]', function () {}, true); thx. you add ngclick on button: <button ng-click="addwatch()" style="margin-left:10px;" class="btn btn-danger btn-xs"> re-init tableau </button> and in controller: $scope.addwatch = function(){ if( !$scope.iswatchadded ) { $scope.$watch('[]', function () {}, true); $scope.iswatchadded = true; } } this add once watch expression

datetime - how to get number of years between two dates in android -

this question has answer here: how calculate someone's age in java? 26 answers hello creating android app in have 2 string of different dates want number of years between these dates please me how can this? here code string birthday=p.getstring("birthday"); log.i("bd", string.valueof(birthday)); calendar c = calendar.getinstance(); simpledateformat df = new simpledateformat("dd mmm, yyyy"); final string formatteddate = df.format(c.gettime()); log.i("formatteddate", string.valueof(formatteddate)); where birthday saved date , formatteddate current date want difference between these please try code string birthday = p.getstring("birthday"); calendar calendarbirthday =...

Confusion on when and if to use Claims and Roles with Asp.net Identity 2 -

i'm starting new asp.net project (webapi , webui) using identity 2. struggling understand when , if use claims @ all. my app require users login , old membership system, have added them role when register. should continue doing or there better way handle of nowadays? wouldnt using roles , claims overcomplicate things? thanks always use claims. .net identities claims-based default. btw, role claim - claim of type claimtypes.role.

templates - Saltstack load pillar in a for loop -

i developing automatic proftd installation whit salt, wont ftp users template cant work pillar, initialized pillar whit users data , call loop, don't pillar user data in loop. when make salt-call pillar.get ftpusers in minion, response is: local: this pillar ftpusers.sls: ftp-server.ftpusers: user: - user: user - passhash: j2k3hk134123l1234ljh!"·$ser - uuid: 1001 - guid: 1001 - home: /srv/ftp/user - shel: /bin/false and loop: {% users in pillar.get('ftpusers', {}).items() %} /srv/herma-ftp/.ftpusers: file.managed: - user: root - group: root - mode: 444 - contents:'{{ user }}:{{ args['passhash'] }}:{{args['uuid'] }}:{{ args['guid'] }}::{{ args['home'] }}:{{ args['shel'] }}' - require: - file: /srv/herma-ftp /srv/herma-ftp/{{user}}: file.directory: - user: nobody - group: nobody - dir_mode: 775 - makedirs: ...

apache - Redirect all deeplinks to new domain with slight change in all URL's -

i trying redirect pages of domaina domainb slight change in url structure. for example: i need redirect: http://www.domaina.com/cars/fast-motors -> http://www.domainb.com/vehicles/fast-cars http://www.domaina.com/cars/slow-motors -> http://www.domainb.com/vehicles/slow-cars http://www.domaina.com/cars/red-motors -> http://www.domainb.com/vehicles/red-cars http://www.domaina.com/cars/pink-motors -> http://www.domainb.com/vehicles/pink-cars i can manage redirtect allurls new domain this: rewriteengine on rewriterule ^cars/(.*)$ http://www.domainb.com/vehicles/ $1 [r=301,l] but cant work out how change last word. theres thousands of these urls cant manually list of 301s. need redirect urls new domain switch /cars/ /vehicles/ , -motors -cars . any appreciated. thanks you can use in .htaccess file : rewriteengine on rewriterule ^cars/(.*)-motors/? http://www.domainb.com/vehicles/$1-cars [r=302,l] change [r=302]...