Posts

Showing posts from September, 2014

java - Loading Wordnet into Neo4j -

i trying explore wordnet , import neo4j, because: i find graph database easy use , way analyze relationships while understand concept of triples , rdf/owl, not @ find them easy work yet my problem though javascript developer , have seen no advice how node.js. have found few resources java, experience java extremely rusty , sorely lacking, few guides , papers have found go way on head in terms of implementation. did find piece of code though, designed load files here . loaded eclipse , imported correct dependencies (i think) maven , tried running it, keep getting noclassdeffounderror cannot root cause. has tried use code , had success recently, or can recommend approach me load wordnet neo4j? 11:08:52.835 [main] warn o.neo4j.kernel.embeddedgraphdatabase - using unsupported version of java runtime. please use oracle(r) java(tm) runtime environment 7. java.lang.noclassdeffounderror: org/openrdf/model/impl/simplevaluefactory @ org.openrdf.rio.rdfformat.<clinit>(

java - android how to identify the same days of a week -

to manage dates i'm using class calendar. i'm saving timestamps in db, using calendar timestamp = calendar.getinstance(); i'm able save , retrieve dates db using long values store dates. this problem: when have timestamp store, need know if in db there timestamp belonging same week. thought use couple of methods: timestamp.get(calendar.year) , timestamp.get(calendar.week_of_year) to uniquely identify week, isn't true weeks having days belonging 2 consecutive years. this example of last week of year 2014. saturday, december 27, 2014 year: 2014 week: 52 sunday, december 28, 2014 year: 2014 week: 1 monday, december 29, 2014 year: 2014 week: 1 tuesday, december 30, 2014 year: 2014 week: 1 wednesday, december 31, 2014 year: 2014 week: 1 thursday, january 1, 2015 year: 2015 week: 1 friday, january 2, 2015 year: 2015 week: 1 saturday, january 3, 2015 year: 2015 week: 1 sunday, january 4, 2015 year: 2015 week: 2 the days 28/12/2014 3/1/2015

c# - Windows phone proper way to display collection of items -

i have xml file items , i'm deserializing them observablecollection<usercontrol> , want put itemscontrol own layout. now i've created own usercontrol handle deserialized data layout , observablecollection binded itemscontrol if want display more 5-10 items app if getting unresponsive while. how can avoid freezes? should use datatemplate within itemscontrol or other ideas? i'm wondering how done in apps twitter or reddit have many entries , working quite nice. have searched reddit/twitter app source how have implemented it, without success. edit: xaml <scrollviewer> <itemscontrol x:name="items" itemssource="{binding}"> <itemscontrol.itemspanel> <itemspaneltemplate> <virtualizingstackpanel /> </itemspaneltemplate> </itemscontrol.itemspanel> </itemscontrol> </scrollviewer> c# pu

ruby on rails - Pass block to registrations controller, devise_token_auth syntax? -

i have user , admin classes, have associated profile polymorphic has_one. i've found example vanilla devise build profile in new method user class, if try override method nothing happens. in the devise token auth documentation says can pass block controller want extend , block run after controller performs standard function. example looks this: class custom::registrationscontroller < devisetokenauth::registrationscontroller def create super |resource| resource.do_something(extra) end end end i need sorting out syntax of looks like. need call build_profile in create method, can't happen no matter put in block. if run outside block runs when registrations controller called (and can see controller getting called in logs.) so, how call build_profile in block passed super, question.

angularjs - How to edit item? -

so have simple example how add , remove items problem editing.i have fiddle: https://jsfiddle.net/b24dqk0r/3/ want when user click ok save item in array.any suggestion? $scope.save = function (firstname) { $scope.persons.splice(1,firstname) } <!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> <script src="angular/angular.min.js"></script> <script> var app = angular.module('myapp', []); app.controller('myctrl', function($scope) { $scope.persons = []; $scope.firstname = ""; $scope.showedit = false; $scope.editvalue=""; $scope.additem = function(item) { $scope.persons.push(item); $scope.firstname =""; } $scope.removeitem = function(person) { $scope.persons.splice( $scope.persons.indexof(person), 1 ); }

r - What is the meaning of dot dot in this ggplot expression? -

this question has answer here: double dots in ggplot 1 answer special variables in ggplot (..count.., ..density.., etc.) 1 answer i found expression while working on ggplot. qplot(carat, ..density.., data = diamonds, facets = color ~ ., geom = "histogram", binwidth = 0.1, xlim = c(0, 3)) how ..density.. interpreted r? clearly not variable , processed inside function convey want use density undertand how works @ language level. normally, aesthetics 1:1 mapping column in input data.frame. in case, density output of binning histogram. so, ggplot2 way of referring derivatives product of aggregation, such binning histogram in case.

ducplicate key error when copying mysql database with add constraint error -

i trying copy mysql database. what add_constraint option ? when select option, duplicate key error. when check, there no duplicate key in initial sql statement allowed me create original database in first place. any insight appreciated :)

javascript - I can not populate JQuery Autocomplete input with a json request to cakephp -

Image
i using jquery autocomplete send json request cakephp application, javascript code http://jqueryui.com/autocomplete/ $(function() { function split( val ) { return val.split( /,\s*/ ); } function extractlast( term ) { return split( term ).pop(); } $( "#tag-string" ) // don't navigate away field on tab when selecting item .bind( "keydown", function( event ) { if ( event.keycode === $.ui.keycode.tab && $( ).autocomplete( "instance" ).menu.active ) { event.preventdefault(); } }) .autocomplete({ source:function(request, response){ $.getjson("/articles/gettags/" + request.term + ".json", { term : extractlast(request.term) }, response); }, search: function() { // custom minlength var term = extractlast( this.value ); if ( term.length < 1 ) {

C# WPF application launches in Visual, but not when ran directly -

i'm making wpf apllication , works how it's supposed when run inside visual studio. if navigate folder , run there, crashes without kind of message. here video demonstration: http://youtu.be/gvonat387vq this application worked fine before when in 0.9. point on added new grid, started using properties.settings.default , added handler readonly files (because application reads , writes configuration file). , none of these seem cause issue. edit: reason found. event viewer wrote error out. part of messagebox handled exception implemented: system.windows.markup.xamlparseexception: invocation of constructor on type 'dayz_config_tweak_tool.mainwindow' matches specified binding constraint threw exception. ---> system.formatexception: token not valid. @ ms.internal.parsers.parsebrush(string brush, iformatprovider formatprovider, itypedescriptorcontext contex) @ system.windows.media.brush.parse(string value, itypedescriptorcontext context) @ system.windows.me

ruby on rails - Kaminari and PG::UndefinedFunction: ERROR: could not identify an equality operator for type point -

i have 2 models: country , resort . resort has field point type "point". model country has_many resort s. when countries resorts kaminari( .page(params[:page]).per(20) ) have error: pg::undefinedfunction: error: not identify equality operator type point line 1: select distinct "resorts".* "resorts" inner join "coun... ^ : select distinct "resorts".* "resorts" inner join "country_resorts" on "resorts"."id" = "country_resorts"."resort_id" "country_resorts"."country_id" = $1 , "country_resorts"."what" = $2 limit 20 offset 0 pg::undefinedfunction: error: not identify equality operator type point line 1: select distinct "resorts".* "resorts" inner join "coun... if resorts without kaminari normal result. how can resolve issue?

xml - Installing "SSOAP package" on Rstudio (Mac OS) - getting error -

i want connect r script soap web server in order extract data. im r newbie decent programmer. i have installed rstudio i installed rcurl , xml2 packages. now im trying install the ssoap package. downloaded .tar.gz file here: http://www.omegahat.org/ssoap/ next on rstudio , used "install" button under "packages", see here: i error after: > library("rcurl", lib.loc="/library/frameworks/r.framework/versions/3.2/resources/library") loading required package: bitops > library("xml2", lib.loc="/library/frameworks/r.framework/versions/3.2/resources/library") > install.packages("~/desktop/r/downloads/ssoap_0.9-0.tar.gz", repos = null, type = "source") error: dependencies ‘xml’, ‘xmlschema’ not available package ‘ssoap’ * removing ‘/library/frameworks/r.framework/versions/3.2/resources/library/ssoap’ warning in install.packages : installation of package ‘/users/xx/desktop/r/downl

cocoa bindings - NSArrayController bind it to sort descriptor using the nib -

Image
i'm trying figure go set sort descriptor in binding nsarraycontroller have not able find example of how it. i have nsarraycontroller bind core data , want sort data. question how can using bindings: i'll appreciate if i think mean want enter sort descriptor directly in nib. can't that. bindings allow connect array controller's sortdescriptors property property of other controller object stay in sync. is, need object implement property indexed collection (like array) of nssortdescriptor object. window or view controller. then, bind array controller's sort descriptors binding object key path naming property. that doesn't let set sort descriptors in nib.

javascript - the requested resource does not support http method 'get'. Cross Domain -

i searching solution problem quite while. finding many answers question, cant figured out. here problem: trying send json file domain (its external firm web api cooperation firms), should send me json (i using mvc webapps), without using controller... first of had problem cross-domain, tried figured out editing web.config (see above). <system.webserver> <httpprotocol> <customheaders> <remove name="x-powered-by" /> <add name="access-control-allow-origin" value="*" /> <add name="access-control-allow-headers" value="content-type" /> <add name="access-control-allow-methods" value="get, post, put, delete, options" /> </customheaders> </httpprotocol> this did not help. after using jsonp (see following jc code), problem solved. "the requested resource not support http method 'get'" - err

c++ - Why is this compiler error happening? -

i working on exception handling piece of software write in c++. encounter compiler error (using g++ (gcc) 4.8.1 / mingw32) don't understand, here minimal example: #include <iostream> #include <exception> class bad_img_load: public std::exception { //public: virtual const char* what() const throw(){ return "an image not loaded."; } }; int main () { try{ throw bad_img_load(); }catch (bad_img_load& e){ std::cout << e.what() << '\n'; } return 0; } the error is: a.cpp: in function 'int main()': a.cpp:6:22: error: 'virtual const char* bad_img_load::what() const' private virtual const char* what() const throw(){ ^ a.cpp:15:25: error: within context std::cout << e.what() << '\n'; ^ note if uncomment line 'public:' works fine. class 'exception' inherits defines public. don'

ios swift uitableview sections with different tabledata -

i have list of data coming in json. list load tableview within 2 seperate sections called featured , all. trying figure out how "featured" section not load same amount of rows "all" section. section featured section shows featured list plus 16 empty rows. ideas on how rid of these rows in featured section? func tableview(tableview: uitableview, titleforheaderinsection section: int) -> string? { if(section == 0) { return "featured" } return "all" } func numberofsectionsintableview(tableview: uitableview) -> int { var sections: int = 2 return sections } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { var count: int = tabledata.count println("tabledata \(count)") return count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { //let session = nsurlsession.sharedsession() tab

c# - How to decouple objects in MVC Web API service and apps which uses it? -

i've finished working on mvc web api service, purpose show data microsft analysis cube, , return json objects. so lets have object loaded cube , returned service json: public class person{ public string name {get;set;} public double balance {get;set;} } now on mvc app makes request service create exact same class, can desirealize json. can see if person object extended lastname atribute, have add exact same attribute in app too. there architecturs / patterns avoid creating exact same class/object on both app , webservice? maybe create separate library contains nessesary objects, , parse in dll webservice , app? or there other way? @ahmed right. should create separate models or view models expose data per tier. there security implications when overpost data endpoints. data may highly confidential salary, example, , show in wrong places. may use automapper map data between tiers. looks @ least addresses problem trying solve: https://github.com/automapper/aut

ios - How to sort array based on another arrays position? -

i have tableview style being right detail . therefore have 2 arrays , 1 textlabels data, , other detailtextlabel . there 2 "sort by" options. 1 sort textlabels data, , second sort detailtextlabels data. when sort first array ( textlabels array ), second array (detailtextlables array ) have sorted based on first array`. i know how sort arrays , how can sort 1 array based on another? here's how sorted array : (it's array of dates . firstarray.sort({ (a, b) -> bool in a.earlierdate(b) == }) it's bit messy, can use enumerate work indices , elements @ same time: array1.enumerate().sort { return $0.element < $1.element }.map {$0.element} array1.enumerate().sort { return array2[$0.index] < array2[$1.index] }.map {$0.element} but it's simpler/easier 1 array. struct item { let prop1: int let prop2: string } var array = [ item(prop1: 1, prop2: "c"), item(prop1: 2, prop2: "b"),

algorithm - Amortized Cost Analysis with a Stack -

suppose have stack backed n-element array cost 1 push, cost 1 take element out of array, , cost of resizing array number of elements moved. 1) every time stack becomes full, copy on current n elements new array that's 1 element larger before. text claims series of n pushes result in total cost of: 1 + 2 + 3 + ... + n why this? array starts off n = 1. i push , stack full (cost 1) increment size of array (n = 2 , cost of 2) push , stack full (cost of 1) increment size of array (n = 3 , cost of 4) ... what missing? 2) suppose double size of array every time stack full. have series of n pushes starting 1-element array: i push , stack full (cost of 1) double array size , copy 1 element on (cost of 2, n = 2) push , stack full (cost of 1) double array size , copy 2 elements on (cost of 4, n = 4) ... does analysis right? for series of n pushes, yield 1 + 2 + 1 + 4 + 1 + 8 + ... + 1 + 2 ^ (n/2) everything sounds reasonable me: 1) let's start empty s

imacros - how to get content of external file php -

i new in imacros , need help. esotu writing imacros script , did not want leave code accessible user changes , maintenance work gives me later. i need imacro code external php file of website . the idea macro has url php file, , contents of file run when macro run . so far have code here, , can not imacro read contents of php file: version build=8530828 recorder=fx set !errorignore yes set !timeout_tag 1 set !timeout_step 1 set !timeout_page 30 set !replayspeed fast set !datasource http://www. site .com/todocodigoaqui.php set !datasource_columns 1 set !loop 1 set !datasource_line {{!loop}} set !todocodigoaqui url goto={{!col1}} thanks tab t=1 tab closeallothers the variant firefox 'imacros': const l = "\n"; var m = "tab t=1" + l; m += "tab open" + l; m += "tab t=2" + l; m += "url goto=http://www. site .com/todocodigoaqui.php" + l; m += "tag pos=1 type=html attr=* extract=txt" +

javascript - My JQuery validation plugin behaves strangely with checkbox inputs -

i wrote own general use validation plugin(s) take function check if input valid , callback each of cases input determined valid , invalid first function. basically, plugin consists of 2 functions, '$.fn.validation()' bind object containing validation logic , success/failure callbacks element , '$.fn.validate()' either invoke validation object, or if new object passed in use new object 1 instance. implementation of plugins , a jsfiddle demonstrating issues described below can found here. my issue while text input , texareas seem work in cases, depending on how elements, such checkbox inputs, selected, elements may not validated despite being in set of elements returned jquery element for example, following selector not result in check boxes being validated $('input, textarea').validate(); however more specific selector result in checkboxes being validated $('input[type=checkbox]').validate(); again, please checkout jsfiddle have replic

arrays - How to find a row or column under specific conditions in a matrix in R -

this question has answer here: given value of matrix, getting it's coordinate 2 answers for example, if have matrix or array following format how can find index of rows or columns have numbers between 10 20 inside ? m = array(c(1,1,12,34,0,19,15,1,0,17,12,0,21,1,11,1), dim=c(4,4)) and, also, not allowed use or while loops this. thing matrix or array may have more 2 dimensions. if method can apply multi-dimensional matrix or array, better me. thanks. instead of trying find index of qualified single elements, need find rows or columns in elements between interval. in example, hope have result telling me row number 3 row numbers within row between 10 20. use which(..., arr.ind = true) . here assume between means 10 , 20 non-inclusive which(m > 10 & m < 20, arr.ind = true) # row col # [1,] 3 1 # [2,] 2 2 # [3,] 3 2

c++ - Ordered associative containers of pointers -

this question has answer here: are pointers allowed keys in ordered stl containers? 4 answers is okay practice define ordered associative containers of pointers (either built-in or class-type ones) despite fact that, far can tell standard, relational operators on (non-array objects et al.) pointers undefined? from 5.9 of c++11 standard: if 2 pointers p , q of same type point different objects not members of same object or elements of same array or different functions, or if 1 of them null, results of p<q , p>q , p<=q , , p>=q unspecified. since ordered containers (map, set, multimap , multiset) use < operator default provide total order compiles fine create set of pointers. again if relational operators pointers unspecified p<q , p>q both test false or true meaning may not idea ordering of set . would've accepted bad id

python - Adding a bytearray as a key to a dictionary -

i getting error while adding bytearray key dictionary: typeerror: unhashable type: 'bytearray' here code: str_dict = {} s = bytearray(10) x in range(0, 10): value = get_str(s) str_dict[s] = value so create bytearray , function get_str(s) updates s , returns 'value'. want add both value , updated s dictionary. above error. {[1, 2, 3]: 1} typeerror: unhashable type: 'list' a dict key has immutable type. list or bytearray can't use key because mutable , reason can't unique since can changed. it seems if object __hash__ method can use key though : i'm able use mutable object dictionary key in python. not disallowed?

Combine bidimensional array with another single dimension array in php -

i want combine 2 arrays keeping keys digit order. here's first array: array:3 [▼ 0 => array:1 [▼ "nombre" => "pilsener" ] 1 => array:1 [▼ "nombre" => "golden" ] 2 => array:1 [▼ "nombre" => "suprema" ] ] and here's other array: array:3 [▼ 0 => "6" 1 => "5" 2 => "1" ] what want is: array:3 [▼ 0 => array:1 [▼ "nombre" => "pilsener" "cantidad" => "6" ] 1 => array:1 [▼ "nombre" => "golden" "cantidad" => "5" ] 2 => array:1 [▼ "nombre" => "suprema" "cantidad" => "1" ] ] i searched , found this didn't worked me... since don't have strings keys can't use array_merge_re

c - Error while initializing the structure values -

i have started using pointers.so please bear me if looks silly not able find reason. have structure typedef struct intermediatenode { int key; char *value; int height; struct node *next[skiplist_max_height]; } node; and wand create new node using below function node *create_node(int key, char * val, int h) { node *newnode; newnode=malloc(sizeof(node)); newnode->height=h; newnode->key=key; printf("till here %s \n",val); printf("till here %d \n",newnode->height); printf("till here %d \n",newnode->key); strcpy(newnode->value,val); printf("till here %s \n",newnode->value); return newnode; } but getting segmentation fault @ "strcpy(newnode->value,val);" can please me that.thanks lot you allocated memory node, not string in value . strcpy function copy bytes not allocate memory. assumes you've ar

ios - UIActivityViewController is always sharing image before text -

in app, want share current song , artist followed album artwork. here code: var sharingitems = [anyobject]() let currentsong = musicplayer.nowplayingitem?.title let currentartist = musicplayer.nowplayingitem?.artist let artwork = musicplayer.nowplayingitem?.artwork let artworkimage = artwork?.imagewithsize(cgsizemake(100, 100)) let sharetext = "now playing \(currentsong!) \(currentartist!) via ryan's awesome app" sharingitems.append(sharetext) //text first, image sharingitems.append(artworkimage!) let activityviewcontroller = uiactivityviewcontroller(activityitems: sharingitems, applicationactivities: nil) activityviewcontroller.excludedactivitytypes = [uiactivitytypeaddtoreadinglist, uiactivitytypeassigntocontact, uiactivitytypeopeninibooks, uiactivitytypeprint, uiactivitytypesavetocameraroll] self.presentviewcontroller(activityviewcontroller, animated: true, completion: nil) when choose share option, messges, image

input from file in java -

i java beginner learner , trying output data on file call a.txt. need have no idea y getting exception error file not open . put a.txt in same directory in have main , readfile. - main path : c:\users\navdeep\desktop\java\assign1\src\assign1 - readfile : c:\users\navdeep\desktop\java\assign1\src\assign1 - a.txt : c:\users\navdeep\desktop\java\assign1\src\assign1 thanks in advance . main.java package assign1; public class main { public static void main(string[] args) { readfile r = new readfile(); r.openfile(); r.readfile(); r.closefile(); } } readile.java package assign1; import java.io.*; import java.util.*; public class readfile { private scanner x; public void openfile() { try { x = new scanner(new file("a.txt")); } catch (exception e) { system.out.println("file not open \n"); } } public void readfile() { while (x.hasnext()) {

garbage collection - High Number of CMS mark remark pauses even though Old gen is not half full -

i trying understand cause high number of cms marks , remarks(other phases well) averaging around 700ms though old gen not half full.following gc configurations , stats gcviewer. -xms3g -xmx3g -xx:newsize=1800m -xx:maxnewsize=1800m -xx:maxpermsize=256m -xx:survivorratio=8 -xx:+useconcmarksweepgc -xx:+cmsclassunloadingenabled summary using gc viewer: http://i.imgur.com/0iibnur.png gc log 152433.761: [gc [1 cms-initial-mark: 284761k(1302528k)] 692884k(2961408k), 0.3367298 secs] [times: user=0.33 sys=0.00, real=0.34 secs] 152434.098: [cms-concurrent-mark-start] 152434.417: [cms-concurrent-mark: 0.318/0.318 secs] [times: user=1.38 sys=0.02, real=0.32 secs] 152434.417: [cms-concurrent-preclean-start] 152434.426: [cms-concurrent-preclean: 0.008/0.009 secs] [times: user=0.02 sys=0.00, real=0.01 secs] 152434.426: [cms-concurrent-abortable-preclean-start] cms: abort preclean due time 152439.545: [cms-concurrent-abortable-preclean: 4.157/5.119 secs] [times: user=5.82 sys=0.20,

asp.net mvc - AJAX POST does not return a file download -

i have post ajax request in asp.net mvc application, works this: $.ajax({ type: "post", url: 'https://localhost:44300/api/values', data: ruledata, contenttype: "application/json; charset=utf-8" }); in case, ruledata encompasses json blob: var ruledata = json.stringify({ 'targetproduct': "someproduct", 'content': editor.getvalue(), 'targetproductversion' : "1.0" }); the request backed post handled in web api application, returns pushstreamcontent appropriate headers. return new httpresponsemessage(httpstatuscode.ok) { content = pushstreamcontent}; in fiddler, see response web api coming application/octet-stream , in right size expecting (it generates zip file in backend), there never dialog shown allow user download file. what missing? solved xhr var xhr = new xmlhttprequest(); xhr.responsetype = "blob"; xhr.onreadys

Email form submit shows email log -

i completed 1.0 version of website , uploaded dreamhost’s server, i’m having issues submitting email form. when host locally, goes through no problems. however, when on server, displays email log: server -> client: 220 smtp.postmarkapp.com esmtp sc-iad-smtp2 client -> server: ehlo [website] server -> client: 250-smtp.postmarkapp.com250-pipelining250-size 20480000250-vrfy250-etrn250-starttls250-auth plain login cram-md5 digest-md5250-auth=plain login cram-md5 digest-md5250-enhancedstatuscodes250-8bitmime250 dsn client -> server: auth login server -> client: 334 vxnlcm5hbwu6 client -> server: nzi2nzexnwitnzywnc00zde2ltk0mmetndiwm2y5ntm2njk5 server -> client: 334 ugfzc3dvcmq6 client -> server: nzi2nzexnwitnzywnc00zde2ltk0mmetndiwm2y5ntm2njk5 server -> client: 235 2.7.0 authentication successful i’m using postmark app while hosted on dreamhost. i’ve tried editing field: if (!$mail->send()) { echo "there problem sending email:" . $mail->

libreoffice calc - Create ODS worksheets from CSV files -

i have set of csv files, need convert single ods (or excel) spreadsheet multiple tabbed worksheets. i'm using pyexcel library python, it's buggy , horribly slow. libreoffice has nice file conversion utility, don't see support worksheet tabs. there simple way script this?

yii2: How can I configure Url manager when using module and GET parameters? -

i trying configure url's in modules getting 404 error on accessing following url's. products page url example: http://localhost/jambomall/web/products/products/details-product?deal_key=nvx3ftqf&url_title=3-jojo-cat-ponted-heels i want url manager show this: http://localhost/jambomall/web/products/details-product/nvx3ftqf/3-jojo-cat-ponted-heels how can configure url manager display this? not working me. 'products/<deal_key:\w+>/<url_title:\w+>' => 'products/products/details-products' here web.php 'urlmanager' => [ 'class' => 'yii\web\urlmanager', 'showscriptname' => false, 'enableprettyurl' => true, 'rules' => [ 'products/<deal_key:\w+>/<url_title:\w+>' => 'products/products/details-product', ], ], and .htaccess in web folder rewriteengine on # if directory or file

paypal error processing payment bmcreatebutton -

i creating paypal buttons on fly shopping cart processing. i've used express checkout no issues client not want customers have complete billing details on ec page, using hosted payment buttons seems solution. i create button using nvp code sending following: ( [l_buttonvar0] => business=emailaddress [l_buttonvar1] => paymentaction=sale [l_buttonvar2] => currency_code=aud [l_buttonvar3] => cancel_return=http://localhost/orders/view/335774 [l_buttonvar4] => notify_url=http://localhost/orders/complete_hostedpaypal/335774 [l_buttonvar5] => return=http://localhost/orders/view/335774 [l_buttonvar6] => invoice=order #335774 [l_buttonvar7] => subtotal=167.40 [l_buttonvar8] => tax=2 [l_buttonvar9] => shipping=3 [l_buttonvar10] => handling=4 [l_buttonvar11] => template=templatec [l_buttonvar12] => first_name=test [l_buttonvar13] => last_name=order [l_buttonvar14] => buyer_email=emailaddress [l_buttonvar15] => address1=po box 2633 [l_but

php - String encryption with salt of fixed length -

i need create password generation method user passes in string , gets password encrypted using salt. when user keys in same string same password. <?php $texttoencrypt = "string passed user"; $encryptionmethod = "aes-256-cbc"; $secrethash = "25c6c7ff35b9979bdsfdsgsdfsdf"; //to encrypt $encryptedmessage = openssl_encrypt($texttoencrypt, $encryptionmethod, $secrethash); //to decrypt $decryptedmessage = openssl_decrypt($encryptedmessage, $encryptionmethod, $secrethash); //result echo "encrypted: $encryptedmessage\n"; echo "decrypted: $decryptedmessage\n"; i need have password of length 16 or 10 , have option of alphanumeric , or special character parameters. i recommend using existing method it. if roll own, there many ways make cryptographically insecure mistake (in case, timing or power differential attack unlikely still). here method looks right asking: string hash_pbkdf2 ( string $algo , string $password , s

c# - MVC - Assigning Values to Dictionary -

i trying add dictionary values in view , following code :- public class { public int employeeid { get; set; } public int employeename { get; set; } public dictionary<string, double> dic1 { get; set; } public dictionary<string, double> dic2 { get; set; } } view :- @model list<models.to> @for (int = 0; < @model.count; i++) { @html.hiddenfor(m => m[i].employeeid) @html.hiddenfor(m => m[i].employeename) .... @html.hiddenfor(m => m[i].dic1, value = "") // psuedo } as have assigned values employeeid & employeename in post method in controller , how assign values dictionary ? you can't put whole dictionary hidden field. dictionary enumerable, have work out each key/value. @for (int = 0; < @model.count; i++) { @html.hiddenfor(m => m[i].employeeid) @html.hiddenfor(m => m[i].employeename) .... foreach (string key in dic1.key

php - Trying to get property of non-object in laravel -

i have following code in controller public function viewpost($id) { $viewpost= post::find($id); return view('guest.viewpost', ['viewpost'=>$viewpost]); } in view @foreach($viewpost $val) <br> post title= <a href="viewpost/{{$val->id}}" >{{$val->post_title}}</a> <br> post content={{$val->post_content}} <br> <br> featured image=<img src="{{$val->featured_image}}" height="150" width="150"> @endforeach but above code throw error trying property of non-object. tried following way $val['post_title']; the above code wont throw error nor displaying output. if print in controller display output same in view if print give error print_r($viewpost); i using laravel 5.1. can 1 tell doing wrong ? thank you. update after suggestion of @coderom

if statement - if else condition in angularjs to compare string and int value -

i want check if both font , fontsize undefined sent client side.when user not select font or font size, pass value undefined. these conditions work when 1 of them (font or font size) undefined, when both of them undefined, recieve error, typeerror: cannot read property 'font' of undefined @ scope.stylesctrl.$scope.addstyles (http://0.0.0.0:8080/app/edit/styles/stylesctrl.js:26:38) @ fn (eval @ <anonymous> (http://0.0.0.0:8080/bower_components/angular/angular.js:13231:15), <anonymous>:4:317) @ ngeventdirectives.(anonymous function).compile.element.on.callback (http://0.0.0.0:8080/bower_components/angular/angular.js:23411:17) @ scope.$get.scope.$eval (http://0.0.0.0:8080/bower_components/angular/angular.js:15916:28) @ scope.$get.scope.$apply (http://0.0.0.0:8080/bower_components/angular/angular.js:16016:25) @ htmlinputelement.<anonymous> (http://0.0.0.0:8080/bower_components/angular/angular.js:23416:23) @ htmlinputelement.jquery

python - Fill 24 hours of data into five years of hourly dataframe -

i have dataframe of 5 years worth of hourly data. import datetime dt startdate = dt.date(2008,1,1) enddate = dt.date(2015,8,1) dfindex = pd.date_range(start=startdate,end=enddate,freq='h') dfcolumns = ['c1','c2','c2'] df = pd.dataframe(index=dfindex,columns=dfcolumns) i have dataframe 24 hours. dftemp = pd.dataframe(np.random.randint(60,100,(24,3)),index=pd.date_range(startdate,periods=24,freq='h'),columns='c1 c2 c3'.split()) i fill each day of first dataframe data second dataframe. instead of looping through each day .. there simple way of achieving this? in python can repeat list using * operator, example print([1,2,3]*2) [1, 2, 3, 1, 2, 3] so example, repeat sample data len(df)/24 times , set original dataframe using iloc , (i've had select iloc[:-1,:] since index contains 1 time point on last day): df.iloc[:-1,:] = dftemp.values.tolist()*(int(len(df)/24)) df.head() out[198]: c1 c

android - PendingIntent error ( Must be one or more of: PendingIntent.FLAG_ONE_SHOT …..) -

i trying create pendingintent in android. here code mnotificationintent = new intent(getapplicationcontent(), myalarm.class); mcontentintent = pendingintent.getactivity(getapplicationcontext(), 0, mnotificationintent, intent.flag_activity_new_task); and getting following error: must 1 or more of: pendingintent.flag_one_shot,pendingintent.flag_no_create, pendingintent.flag_update_current, intent.fill_in_action, intent.fill_in_data, intent.fill_in_categories…..) why error showing ? how resolve this? please help. thank you. you passing intent.flag_activity_new_task when method call expects pendingintent flag. if want add intent.flag_activity_new_task intent , need this: mnotificationintent = new intent(getapplicationcontent(), myalarm.class); mnotificationintent.addflags(intent.flag_activity_new_task); mcontentintent = pendingintent.getactivity(getapplicationcontext(), 0, mnotificationintent, 0);

vbscript - How getObject Function internally works? -

i'm automating inventor 2013 using uft follows:- set oapp = getobject(,"inventor.application") set odoc = oapp.activedocument here i'm using getobject() function reference of running inventor application. have questions getobject() function that 1)how find out application present or in running state? 2)how access header class of particular application access of methods , properties of application's class? can explain this? getobject , createobject part of com automation provided vbscript. vbscript can't use com objects available through windows. vbscript can use objects expose string called programmatic identifier ( progid ). although not com objects have progid, com objects have 128-bit number called class identifier, or clsid. if com object has progid, can use vbscript instantiate object, invoke methods , properties, , destroy object. getobject , createobject works similar in way, serve different purposes. if need creat

asp.net mvc 4 - How to call aspx page from other project to my mvc project in actionresult -

i have mvc project in trying call other web application aspx page on action link click. how pass link in actionresult or return view(). use controller's redirect() method. public actionresult youraction() { // ... return redirect("http://www.example.com"); }

php - How can i get XML data from the dictionary -

below xml format : <item> <title>lorem ipsum</title> <link>http://www.website.com</link> <pubdate>sun, 30 aug 2015 16:51:18 +0000</pubdate> <description> <![cdata[dummy text dummy text dummy text]]> </description> <title>lorem ipsum test</title> <link>http://www.test.com</link> <pubdate>sun, 29 aug 2015 16:51:18 +0000</pubdate> <description> <![cdata[dummy text test dummy text test dummy text test]]> </description> </item> what have tried: <?php $rss = file_get_contents('<url>'); $xml = new simplexmlelement($rss); foreach($xml->channel->item $feed){ $title = $feed->title; $added_date_time = date(

multithreading - Java thread program not working using wait() and notifyAll() -

below program. thread 0 gets printer, other threads not it. there 1 printer object, , want multiple job threads use printer. how make program work jobs printer. me code flow seems fine. synchronizing on single printer object. please help. package classestesting; public class printerqueue { final static printer printer = new printer();; public static void main(string[] args) { // todo auto-generated method stub system.out.println("in main"); (int = 0; < 5; i++) { new thread(new jobs(), "thread - " + i).start(); system.out.println("started " + + " thread"); } } } class printer { private boolean isused; printer() { this.isused = false; } public void setused(boolean used) { this.isused = used; } public boolean isused() { return