Posts

Showing posts from March, 2012

excel vba - VBA BuiltInDocumentProperties -

i have macro sits in workbooka , retrieves data workbookb. want return "last save time" workbookb , put cell within workbooka. in code below "lastsave" named range referring cell in workbooka. i have tried following various websites , similar questions no avail. suspect solution has objects, items in list, values, etc. cannot seem put finger on it. 1) error: object doesn't support property or method dim lastsavetime object set lastsavetime = workbooks(b).builtindocumentproperties("last save time") workbooks(a).sheet1.range("lastsave").value = lastsavetime 2) error: automation error, unspecified error dim lastsavetime variant set lastsavetime = workbooks(b).builtindocumentproperties("last save time") workbooks(a).sheet1.range("lastsave").value = lastsavetime 3) error: method 'value' of object 'documentproperty' failed workbooks(a).sheet1.range("lastsave").value = workbooks(...

javascript - scroll on three finger swipe for ios -

i need make scroll on 3 finger touch , swipe, i'm doing overflow: scroll; , width , height ok too, tried white-space: nowrap; -webkit-overflow-scrolling: touch; no result, works fine on android browsers, not on ios

python 3.x - virtualenv: cannot import name 'main' -

i'm having little trouble virtualenv on mac os x yosemite. after couldn't run virtualenv @ first, installed python 3 via brew (previously installed via package on python.org). linked installation of python3, updated pip , ran pip3 install virtualenv . when try run virtualenv (e.g. $ virtualenv --python=python3 ../virtualenv ), following error message. traceback (most recent call last): file "/usr/local/bin/virtualenv", line 7, in <module> virtualenv import main file "/usr/local/bin/virtualenv.py", line 7, in <module> virtualenv import main importerror: cannot import name 'main' can me this? your virtualenv executable /usr/local/bin/virtualenv importing virtualenv package /usr/local/bin/virtualenv.py . guess package not 1 executable should importing. reason choosing 1 because in same directory. first, check real virtualenv package is. in python3 terminal: >>> import virtualenv >>> virtua...

javascript - Specify HTML DOM nodes for Google page translation (opposite of class=notranslate) -

i know can tell google translate not translate sections using class="notranslate" , can tell google translate specific sections , not rest? if not, alternatives? use attribute translate="" , , specify on body. inside, specify nodes translate. example: <body translate="no"> <p translate="yes">will translated</p> <p>will not translated</p> </body>

c++ - Why can I not access the value in a semantic action? -

i'm trying write parser create ast using boost::spirit. first step i'm trying wrap numerical values in ast node. code i'm using: ast_nodeptr make_ast_nodeptr(const int& i) { return std::make_shared<ast_node>(i); } namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; namespace l = qi::labels; template<typename iterator> struct test_grammar : qi::grammar<iterator, ast_nodeptr(), ascii::space_type> { test_grammar() : test_grammar::base_type(test) { test = qi::int_ [qi::_val = make_ast_nodeptr(qi::_1)]; } qi::rule<iterator, ast_nodeptr(), ascii::space_type> test; }; as far understood documentation q::_1 should contain value parsed qi::int_, above code gives me error along lines invalid initialization of reference of type ‘const int&’ expression of type ‘const _1_type {aka const boost::phoenix::actor<boost::spirit::argument<0> >} why not work though ...

hadoop - GoogleHadoopFileSystem class is missing when enabling TEZ -

we're running hive on hadoop leveraging google cloud storage using bdutil version 1.3.2. 1 of options installed tez. ambari_services='falcon flume ganglia hbase hdfs kafka kerberos mapreduce2 nagios oozie slider sqoop storm tez yarn zookeeper knox hive pig' when running query using mapreduce query engine, runs expected: set hive.execution.engine=mr; but, if change execution engine tez: set hive.execution.engine=tez; i long stacktrace, error is: status: failed vertex failed, vertexname=map 4, vertexid=vertex_1443128249582_0182_1_00, diagnostics=[vertex vertex_1443128249582_0182_1_00 [map 4] killed/failed due to:root_input_init_failure, vertex input: t1 initializer failed, vertex=vertex_1443128249582_0182_1_00 [map 4], java.lang.runtimeexception: java.lang.classnotfoundexception: class com.google.cloud.hadoop.fs.gcs.googlehadoopfilesystem not found i'm assuming means gcs connector jar isn't in right path, i've added link jar...

java - What's a good regex to remove extraneous characters from the end of a string? -

i'm looking regex remove characters @ end of string aren't needed, may present earlier in string (which expected , good). here's example should resolve "carver house - kitchen" carver house - kitchen( carver house - kitchen[ carver house - kitchen - ( carver house - kitchen : here's example should resolve "carver house : (night)[n1] - kitchen" carver house : (night)[n1] - kitchen( carver house : (night)[n1] - kitchen[ carver house : (night)[n1] - kitchen - ( carver house : (night)[n1] - kitchen : so basically, last letter or number should found , else whacked off. also, i'm not looking big messy method goes character character find last alphanumeric. should possible in line or 2 of code. thanks you can use regex \w+$ find non-word-characters @ end of string , replace those. string s = "carver house : (night)[n1] - kitchen - ("; s = s.replaceall("\\w+$", ""); system.out.println(s)...

javascript - Summarizing data for JSON -

{id:1, val:'author', hits:1}, {id:1, val:'author', hits:2}, {id:1, val:'reviewer', hits:1}, {id:2, val:'author', hits:100}, {id: 1, val:'author', hits:5} etc. i want aggregates data (can javascript, jquery, or angular filters single loop) {id: 1, author:3, reviewer:1, hits:9 } {id: 2, author:1, reviewer:0, hits:100} breaking head on bit now!! one possible approach: var source = [ {id:1, val:'author', hits:1}, {id:1, val:'author', hits:2}, {id:1, val:'reviewer', hits:1}, {id:2, val:'author', hits:100}, {id: 1, val:'author', hits:5} ]; var grouped = source.reduce(function(dict, el, i, arr) { var obj = dict[el.id]; if (!obj) { obj = { id: el.id, author: 0, reviewer: 0, hits: 0 }; dict.__arr.push(obj); dict[el.id] = obj; } obj[el.val]++; obj.hits += el.hits; return === arr.length - 1? dict.__arr : dict; }, {__arr:[]}); ...

javascript - How to replace repeating characters with the same number of asterisks? -

i want replace repeated characters same number of asterisks (*). for example: replaceletters("keviin"); should return: kev**n and: replaceletters("haaa"); should return: h*** how can go doing this? if use following code replace repeating characters, replaces whole repetition 1 asterisk instead of same number of asterisks repeating characters. function replaceletters(s) { s.replace(/([^])\1+/g, '*'); } .replace() allows function passed second argument. argument callback function passed matched string. once have access matched string, there number of ways can replace matched string same number of asterisks. for example, turn string array, use map replace each array item asterisk , join array string. function replaceletters(s) { return s.replace(/([^])\1+/g,function(m) { return m.split('').map(function(){ return '*' }).join(''); }); } or replace every character in...

java - can we access working memory fact of drools rule engine in jbpm6 script task? -

is there way access working memory fact of drools rule engine in jbpm6 script task? i have model class : application.java rule : check if salary > 10000 (part of rule group : salarycheck ) jbpm flow : start -> salarycheck(rule task, associated rule group : salarycheck) -> updatescore(script task) -> end updatescore - script rask code: system.out.println(system.out.println((application)(kcontext.getkieruntime().getfacthandles().toarray()[0])); error: java.lang.classcastexception: org.drools.core.common.defaultfacthandle cannot cast org.model.application updated script task: import org.model.application import org.drools.runtime.rule.queryresults import org.drools.runtime.rule.queryresultsrow queryresults results = kcontext.getkieruntime().getqueryresults( "getobjectsofapplication" ); ( queryresultsrow row : results ) { application applicantion = ( application ) row.get( "$result" ); application.setscore(700); system.out....

java - Is a method that has a method call in one if its parameters called tail recursive? -

i studying tail recursion , not sure getting definition right. i saw post's best answer (link) , wondering if method sum(int x, int num) considered tail-recursive in following example: public class tailrecusiontest { private static int total; private static int add(int num) { total+=num; return total; } public static int sum(int x, int num) //this method tail-recursive? { if(num == 0) { return x; } return sum(add(num), num-1); } public static void main(string[] args) { system.out.print("" + sum(0,4)); } } i.e: stopping me create object , have call method ( add(int num) in example) handle data, give output and, by definition , call method tail-recursive ? i asking question because assignment asking me if can make method "tail-recursive", , wonder how far definition of tail-recursion extends. this means can create method , pass in values...

java - How to store the list of installed Android applications into an ArrayList? -

i got list of installed applications , want put them arraylist(for filtering purposes) organized in way - appname, packagename, icon. the closest reference can find don't understand how implement / (use class , methods) code. can me this? in advance. class pinfo { private string appname = ""; private string pname = ""; private string versionname = ""; private int versioncode = 0; private drawable icon; private void prettyprint() { log.v(appname + "\t" + pname + "\t" + versionname + "\t" + versioncode); } } private arraylist<pinfo> getpackages() { arraylist<pinfo> apps = getinstalledapps(false); /* false = no system packages */ final int max = apps.size(); (int i=0; i<max; i++) { apps.get(i).prettyprint(); } return apps; } private arraylist<pinfo> getinstalledapps(boolean getsyspackages) { arraylist<pinfo> res = new ...

How do I make a column not null and be a foreign key in MySQL -

i trying create table foreign key of table , make not null, running trouble making both happen. able foreign keys working did not require not null can't both working. here line giving me trouble constraint instructor foreign key (id) references instructor(id) not null then error: constraint instructor foreign key (id) references instructor(id) not null, * error @ line 5: ora-00907: missing right parenthesis also, getting weird error when trying create table (note, table created after creating table contains above error) fails @ trivial part: create table enrollment ( constraint class_id foreign key (id) references class(id) not null, constraint member_id foreign key (id) references reccentermember(id) not null, cost int not null ); then command error: create table enrollment ( * error @ line 1: ora-00904: : invalid identifier how can fix these 2 errors? ...

c# - Nunit Mocking is little bit of confusing -

how mock query, want test in nunit. can me snippet?this exact service.cs, need mockup , nunit on same. internal class sample : issample { public sample( irepository<productvariant> productvariantrepository, irepository<product> productrepository) { _productvariantrepository = productvariantrepository; _productrepository = productrepository; } public string getvalueabc(int a, int b) { vvar productvariantid = (from pv in _productvariantrepository.table join p in _productrepository.table on pv.productid equals p.id !p.deleted && !pv.deleted && p.id == sku orderby pv.published descending select pv.id).firstordefault(); if (productvariantid == 0) { throw new errorcodeexception(catalogerrorcode.productvariantnotfound); } return "hi"; } }

Access only one attribute of API in response - Ruby on Rails 4 -

i calling api returns array of json objects , can access return values of api call [{"param1":1,"param2":"blah1"}, {"param1":2,"param2":"blah2"}, {"param1":3,"param2":"blah3"}] i know can access each param1 through iteration or static indexing @client[0].param1 @client[1].param1 @client[2].param1 thing , don't want param2 , want param1 . there way , access param1 without iteration or static indexing below result in response [{"param1":1}, {"param1":2}, {"param1":3}] update the thing notice want filter result while making request (before getting response when know attribute name) try use delete . deletes , returns key-value pair hsh key equal key. if key not found, returns default value. if optional code block given , key not found, pass in key , return result of block. data = [{"param1":1,"param2...

azure - How to change *default* open-file limit on Ubuntu 12.4 -

we have ubuntu 12.04 lts servers, both local , hosted in azure. while can change file limits interactively logged in users, seems default, services started init.d hard open-file limit of 4096. while can use upstart , set higher limits specific services, doesn't for, say, hortonworks hdp, runs sorts of services using own mechanisms. want change system-wide default open-file limit everything . how that? 1. check system wide settings: /etc/security/limits.conf a no limitations config file: * soft nofile 102400 * hard nofile 102400 * soft nproc 102400 * hard nproc 102400 root hard nofile 102400 root soft nofile 102400 2. check program auto startup script , settings program auto startup script bit different, has own settings, or use the default 1024 . example: program supervisor(test on ubuntu 12/14) /etc/init.d/supervisor - auto startup script /etc/init/s...

in R, how can I see if three elements of a character vector are the same out of a vector of length 5 -

i have poker hand , need check 3 of kind. there way see if 3 elements in vector same other 2 different? e.g.: hand <- c("q","q","6","5","q") should return true 3 of kind. hand2 <- c("q","q","6","6","q") ...would full-house though, , shouldn't identified 3 of kind. using table , logic checking should there: tab <- table(hand) #hand #5 6 q #1 1 3 any(tab==3) & (sum(tab==1)==2) #[1] true tab <- table(hand2) #hand2 #6 q #2 3 any(tab==3) & (sum(tab==1)==2) #[1] false this works because any across tab le, checking if there card values repeated 3 times. tab==1 part of function checks if values in tab le equal 1, returning true or false each part of table. sum -ing true/false values equivalent summing 1/0 values, if check had sum of 2 other cards, can sure different.

Java Mysql Exception -

i'm getting exception in query inserting data database, inserting lot of data database around 15k lines. exception message: the driver unable create connection due inability establish client portion of socket.this caused limit on number of sockets imposed operating system. limit configurable. my function insert query: public static void insertobject(int modelid,float x,float y,float z,float rx,float ry,float rz){ try { con = drivermanager.getconnection(url, user, password); string query = " insert wastobjects (modelid,x,y,z,rx,ry,rz)" + " values (?, ?, ?, ?, ?, ?, ?)"; preparedstatement preparedstmt = con.preparestatement(query); preparedstmt.setint (1, modelid); preparedstmt.setfloat (2, x); preparedstmt.setfloat (3, y); preparedstmt.setfloat (4, z); preparedstmt.setfloat (5, rx); preparedstmt.setfloat (6, ry); preparedstmt.se...

python - Removing Text and Comparing Integers within Strings -

due original post being filled flamers assuming i'm asking them write code me , refusing answer me @ all, i'm reposting question. i stress fact total beginner @ python, , not here ask people write me, i'm trying ascertain method , guidance on how approach problem, because i'm having real difficulty approaching it, , seems think i'm asking them give me code need, , i'm not. so, on original question. my problem follows, have made mathematics quiz, outputs name , score text file. in program, plan add code @ beginning, run list of options compare , order results text file. program imports entries list, , format follows: ['john : 6', 'bob : 9', 'billy : 2', 'matthew : 7', 'jimmy : 2', 'amy: 9', 'jenny : 10', 'michael : 8'] python recognizes list 8 items, perfect. has name, , score. problem specification i'm working requires me able to: sort in alphabetical order each student's hig...

java - Adding a remove button to each listView element -

i'm learning android , struggling part. have simple activity button adds entries listview in array list. point down road make favorites tab app display items have selected favorite in activity. haven't progressed far yet i'm playing , add remove buttons on each row remove "item." here have far. public class mainactivity extends listactivity { arraylist<string> listitems = new arraylist<string>(); arrayadapter<string> adapter; int click=1; public void additems(view v) { listitems.add("soon item : " + click++); adapter.notifydatasetchanged(); } @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.activity_main); adapter=new arrayadapter<string>(this, android.r.layout.simple_list_item_1, listitems); setlistadapter(adapter); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater(...

ios - Parse relations in Swift -

i'm in process of making app creates events. event has property user saves successfully, want save array of events current user. each time event created i'm trying add event array (for key "events" in user class). what's best way go in swift? here's sample code of save event parse. the first gets image file , passes function save whole event... @ibaction func saveevent(sender: anyobject) { let picturedata = uiimagepngrepresentation(eventimage.image) let file = pffile(name: "eventimage", data: picturedata) file.saveinbackgroundwithblock { (succeeded, error) -> void in if !(error != nil) { self.saveeventtoparse(file) } else if let error = error { println("error: \(error.localizeddescription)") } } } this function saves event func saveeventtoparse(file: pffile) { let event = event(image: file, user: pfuser.currentuser()!, comment: eventdesc...

c++ - Can you explain what this binary swapping operation is doing? -

i'm trying solve programing programing puzzle . puzzle encrypting messages using following c++ code: int main() { int size; cin >> size; unsigned int* = new unsigned int[size / 16]; // <- input tab encrypt unsigned int* b = new unsigned int[size / 16]; // <- output tab (int = 0; < size / 16; i++) { // read size / 16 integers cin >> hex >> a[i]; } (int = 0; < size / 16; i++) { // write size / 16 zeros b b[i] = 0; } (int = 0; < size; i++) (int j = 0; j < size; j++) { b[(i + j) / 32] ^= ( (a[i / 32] >> (i % 32)) & (a[j / 32 + size / 32] >> (j % 32)) & 1 ) << ((i + j) % 32); // magic centaurian operation } for(int = 0; < size / 16; i++) { if (i > 0) { cout << ' '; } cout << setfill('0') << setw(8) << hex << b[i]; // print result } cout << endl; /* luck humans ...

javascript - AJAX and PHP, wont send data -

i have kind of weird problem, can't seem solve. what trying do, call jquery function on 1 page, send argument of function .php-file on same server, have php file read variable, , insert database. the function trigger placed on div, , looks this: <div class="add_button" onclick="addimg('<?php echo $value[id]; ?>');"> the function looks this: function addimg(id) { $.ajax({ url: "addimgs.php", type: "post", data: {"id" : id} }); console.log("function called id: " + id); } i using console try , debug little here, , console.log()-function being executed correctly. log give me error 500 if "url" not exist. lastly, php-code of addimgs.php looks this: <?php $id = $_request['id']; $servername = "localhost"; $username = "username"; $password = "password"; // create connection $co...

matlab - How to get help on a class' method -

how class method/function when there other functions of same name? for example, predict method/function works both treebagger , generalizedlinearmodel class. how respective helpfiles these functions using doc , doc predict returns compactclassificationtree class? http://www.mathworks.com/help/stats/treebagger.predict.html http://www.mathworks.com/help/stats/generalizedlinearmodel.predict.html predict method of each class. can call mytreebagger.predict(data)

asp.net mvc - Unit Test Session doesn't show tests from new test class -

Image
vs2013 update 5 created c# mvc web application project including test project. updated packages... i moved models namespace, model classes , applicationdbcontext new class library, separate mvc web app project. added reference test project this. the test project shows 'controllers' folder , in folder homecontrollertest.cs i wanted add tests model classes, added 'models' folder , similar cs file testing models. class , methods public, , appropriate attributes class [testclass] , methods [testmethod] assigned i added tests insert, get, update , delete 1 of models. everything compiles fine. the unit test sessions show no tests newly added class; see image... i've restarted vs2013, cleaned solution, rebuilt...everything...except make work. how newly added tests run-able via, or visible to, unit test sessions window?? have tried clearing resharper's cache? (resharper > options > environment > general > clear cache). i ha...

python - Beautifulsoup - get_text, output in a single line -

i trying extract text of following page , save single cell of csv file. however, keep getting linebreaks @ places don't see "special" characters (ie there no "\n", "\t", etc in text). second line of csv file has more 1 non-empty cell, instead of saving text single cell. here code: # -*- coding: utf-8 -*- #python3.x import urllib bs4 import beautifulsoup import requests, urllib, csv, re, sys csvfile=open('test.csv', 'w', encoding='cp850', errors='replace') writer=csv.writer(csvfile) list_url= ["http://www.sec.gov/archives/edgar/data/1025315/0000950127-05-000239.txt"] url in list_url: base_url_parts = urllib.parse.urlparse(url) while true: raw_html = urllib.request.urlopen(url).read() soup = beautifulsoup(raw_html) #### scrape page desired info text_10k=[] ten_k=soup.get_text() ten_k=ten_k.strip().replace("\t", " ").replace("\r", " ").r...

c# - If else statement textbox error -

i trying create if else statement show message box if no input. if(textbox1.text==false) { messagebox.show("please fill in boxes") } i have 16 different text box out, need use if else statement each? pass textboxes in list , loop it //create list once in constructor of main form or window list<textbox> list = new list<textbox>() //... list.add(textbox1); list.add(textbox2);' //... loop foreach(textbox txt in list) { if(string.isnullorwhitespace(txt.text)) { messagebox.show("please fill in boxes"); break; } } update if textboxes expecting number/double input use tryparse checking if value valid foreach(textbox txt in list) { double temp; if(double.tryparse(txt.text, temp) == true) { //save or use valid value debug.print(temp.tostring()); } else { messagebox.show("please fill in boxes"); break; } }

ios - How can I embed a link into a photo to be shared on Facebook, like Dropbox app does with FB photo share? -

how can embed link (and message) photo being shared on facebook user of ios app? dropbox automatically when sharing photo facebook app. pre-post screenshot in dropbox app: https://drive.google.com/file/d/0bxomvrzddaviy29ytm1kofvjztq/view result posted on facebook: https://drive.google.com/file/d/0bxomvrzddavine5sbww3wmstz1e/view thanks! set og:image , og:url meta tags on page want share. you can use facebook url linter / debugger verify/inspect meta tags of own page/url or dropbox url example: https://developers.facebook.com/tools/debug/

javascript - How do I completely remove all references to application.js and application.css in a Rails app? -

i'm working in rails 4.2.4 deploy simple web api. interface not require javascript or css, requests application.js , application.css generating log spam , increasing response times. have tried disabling assets , skipping sprockets , pages served app continue reference application.js , application.css , in "hello, world!" controller generated getting started guide . how can permanently disable references these non-existent, unrequired files? modify ./app/views/layouts/application.html.erb have following content: <%= yield %> in other words, remove <html> , <head> , , <body> tags. there several other ways achieve objective, might easiest.

ruby on rails - renamed a table and am getting errors -

i named table types , realized reserved word, renamed 'category`. now when try activerecord query, error: pg::undefinedtable: error: relation "categories" not exist line 5: a.attrelid = '"categories"'::regclass ^ : select a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod pg_attribute left join pg_attrdef d on a.attrelid = d.adrelid , a.attnum = d.adnum a.attrelid = '"categories"'::regclass , a.attnum > 0 , not a.attisdropped order a.attnum i have gone though code , changed relation names, model, controller, etc...but don't know error coming from. or means. here category.rb: class category < activerecord::base has_many :projects end here categories_controller.rb: class cat...

CSS - Images cascading down and not aligning horizontally -

Image
i trying align images horizontally there weird cascading down effect. how can solve this? html (drupal) <div class="view-content"> <div class="views-row views-row-1 views-row-odd views-row-first"> <div class="views-field views-field-title"> <span class="field-content"><a href="/country">up country</a></span> </div> <div class="views-field views-field-field-book-image"> <div class="field-content"> <a href="/country"><img typeof="foaf:image" src="xxx.jpg" width="126" height="192" alt="" /></a> </div> </div> </div> </div> css .field-content img { float: left; padding-right: 10px; max-width: 100%; height: auto; } image hi said here s...

mysql - Database Design - Form Builder -

i developing application spring mvc , hibernate forms can configured dynamically admin. for e.g. default user have attributes firstname, lastname, email. admin can add more fields birthdate, address, anniversary. for have decided use form builder approach. how design database such system? one approach have decided is: http://goo.gl/smvuwl but here not clear, how store data newly created fields. do let me know if need more info. i using spring mvc + hibernate , end mysql it seams solution mentioned in question holds form definition metadata. structure used render form users. form fulfillment data need other tables. form-data: --------- id pk user-id fk form-id fk fulfillment-date last-update-date etc... form-element-data ----------------- id pk form-data-id fk element-id fk value (text) etc... hope helps.

Homebrew failed on installation, but now won't uninstall -

i used following command install homebrew: ruby -e "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install)" which returns error: it appears homebrew installed. if intent reinstall should following before running installer again: ruby -e "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/uninstall)" when run command in terminal, "failed locate homebrew!" i had same issue on mac os. lot of answers on here advised me remove /usr/local/.git did not exist. solution follows: i navigated to: /usr/local/homebrew/bin and ran: ./brew doctor it warned me homebrews bin not found , advised me add .bash_profile so: echo 'export path="/usr/local/homebrew/bin:$path"' >> ~/.bash_profile after started new session , brewing

c++ - How to update an array outside a function (pointing to pointers) -

i have function takes input, pointer 2d array, , pointer 1d array. int resize(double *x, double **y, int n){ the aim of function resize both x , y twice length (n). i create 2 new arrays- have been doubled in length double **ytemp = null; double *xtemp = null; xtemp = new double[2*n + 1]; ytemp = new double*[2*n + 1]; i loop through , replace values of xtemp , ytemp x , y after setting them equal 1 other: y = ytemp; x = xtemp; return 2*n; and exiting function, y , x seem lose length. any on great! your assignments y , x before return setting local values of variables, not ones passed in caller. that, can change function declaration to int resize(double *&x, double **&y, int n){ which allow changing caller's values.

shipping - "Airbill is not allowed for Destination Country" fedex error -

i have shipping country , state canada , puerto rico.for canada postcodes fedex response success puerto rico postcodes fedex return following response stdclass object ( [highestseverity] => error [notifications] => array ( [0] => stdclass object ( [severity] => error [source] => crs [code] => 878 [message] => airbill not allowed destination country. [localizedmessage] => airbill not allowed destination country. ) [1] => stdclass object ( [severity] => note [source] => crs [code] => 820 [message] => destination state/province code has been changed. [localizedmessage] => destination state/province code has been changed. ) ) [transactiondetail] => stdclass object ( [customertransaction...

osx - Chartboost is not shown more than one time -

i new in cocos2dx.now add chartboost in androidstudio. chartboost come 1 time after not shown permanantly.i call delegate log print . log display below. request /interstitial/get succeeded. response code: 200, body: {"message":"no publisher campaigns found","status":404} w/network failure﹕ request /interstitial/get failed error http_not_found: 404 error server i/chartboost﹕ did fail load interstitial 'default error: no_ad_found first try using test id , campaigns project.and after add campaigns ,wait 20 miniut .run project chartboost.for more detail go page

c# - I can not put the image below the text in TabPage headers -

can me, have tabcontrol can not put image below text carries headertab ideas? i use c# , winform to assign images tabpages, can drop imagelist on designer , add images it, select tabcontrol , select imagelist property , set image list created. select tabpages property , edit tab pages, each tab page, select imageindex show image before text . but should know tabcontrol doesn't have built-in support images below/above text automatically , so, should use owner drawn tabcontrol. should set drawmode property ownerdrawfixed , handle drawitem event , draw tab pages yourself.

django - Is there any way to define task quota in celery? -

i have requirements: i have few heavy-resource-consume task - exporting different reports require big complex queries, sub queries there lot users. i have built project in django, , queue task using celery i want restrict user can request 10 report per minute. idea can put hundreds of request 10 minute, want celery execute 10 task user. every user gets turn. is there way celery can this? thanks celery has setting control rate_limit ( http://celery.readthedocs.org/en/latest/userguide/tasks.html#task.rate_limit ), means, number of task running in time frame. set '100/m' (hundred per second) maning system allows 100 tasks per seconds, important notice, setting not per user neither task, per time frame. have thought approach instead of limiting per user? in order have 'rate_limit' per task , user pair have it. think (not sure) use taskrouter or signal based on needs. taskrouters ( http://celery.readthedocs.org/en/latest/userguide/routing.html#route...

oracle - ORA-31011 on XMLTYPE column -

i'm using oracle version - 11.2.0.4 i've reproduced problem i'm facing in more simplified manner below. i've 2 tables xmltype column. table 1 (base_table in example below) has storage model xmltype binary xml. table 2 (my_tab) has storage model xmltype clob. with xml in base_table i'm extracting value of attribute based on condition. attribute in turn name of node in xml contained in my_tab , want extract node's value my_tab. please note not have liberty change logic @ moment. code working fine till storage model xmltype column clob in both tables. base_table recreated (drop , create), it's storage model got modified binary xml understand that's default storage model in version 11.2.0.4 here create table stmt , sample data - create table base_table(xml xmltype); create table my_tab(xml xmltype) xmltype column "xml" store clob; insert base_table(xml) values (xmltype('<root> <element name="nodea"> ...

android - Why my date is not of current day but shows that of 1970? -

my code: date p_selected = new simpledateformat("hh:mm", locale.us) .parse(string.valueof(p_hour[0]) + ":" + string.valueof(p_min[0])); log.d("ttt", "current_time = " + calender.gettime() + "user time = " + p_selected); this log current time of 2015 , why user time 1970? current_time = wed sep 30 11:35:43 gmt+05:30 2015 user time = thu jan 01 11:02:00 gmt+05:30 1970. anything missing here? try this, first way, simpledateformat sdf = new simpledateformat("yyyymmdd_hhmmss"); string currentdateandtime = sdf.format(new date()); tv.settext(currentdateandtime); second way, tvdisplaydate = (textview) findviewbyid(r.id.tvdate); final calendar c = calendar.getinstance(); yy = c.get(calendar.year); mm = c.get(calendar.month); dd = c.get(calendar.day_of_month); // set current date textview tvdisplaydate.settext(new stringbuilder() // month 0 based, add ...

java - Measuring overlap between arrays -

given several arrays in java (i'll looping through keys stored in hashmap), want able identify (based on boolean[] keys stored) indices true in of them, , false . example: {true, true,false} {true,false,false} {true,false, false} would yield index 0 having true values, , index 2 having false values. one idea have convert boolean array array of ints, summing values, , if summed array index = numarrays, true in of them. similarly, if summed array index 0, false in of them. am not sure how go doing in efficient way (in java), letalone if method achieve desired result. is there way convert array of booleans ints? if not, easiest alternative instantiate new array of ints, , loop through boolean array populate new array? assuming arrays have same number of elements can try this: public static void main(string[] args) { boolean[] array1 = new boolean[] {true,true,false}; boolean[] array2 = new boolean[] {true,false,false}; boolean[] array3 = new bo...

html - Changing line height within the dot-points in a list (NOT between the dot-points) -

<ul style="text-align: left; line-height: 85%; color: #bdacab; font-size: 18px; font-family: verdana"> <li>“i swear god had this.” - archer</li> <li>“you’re not supervisor!” - cheryl</li> <li>“phrasing.” - archer</li> <li>“because that’s how ants.” - various</li> <li>“read book!” - archer</li> <li>lana...lana! lana!! ...come on, if don't answer i'm going scream loud possibly ...la"-- "what?!" "i'm sorry, meant "mrs. archer"</li> <li>"oh irony..." - archer</li> <li>"double irony" - archer</li> <li>who...or whom?</li> </ul> ok, can use inline-css styles accomplish this. can't figure out how increase spacing between lines within single dot-point. can adjust spacing between dot-points 'line-height'. it's text long box , wraps down onto next line...this spacing close. example f...

python 2.7 - How to combine multiple feature sets in bag of words -

i have text classification data predictions depending on categories, 'descriptions' , 'components'. classification using bag of words in python scikit on 'descriptions'. want predictions using both categories in bag of words weights individual feature sets x = descriptions + 2* components how should proceed? you can train individual classifiers descriptions , merchants, , obtain final score using score = w1 * predictions + w2 * components. the values of w1 , w2 should obtained using cross validation. alternatively, can train single multiclass classifier combining training dataset. you have 4 classes: neither 'predictions' nor 'components' 'predictions' not 'components' not 'predictions' 'components' 'predictions' , 'components' and can go ahead , train usual.

javascript - Protractor - switch tabs error -

i'm trying switch tab , use controls on new tab , error: unknownerror: null value in entry: name=null this test (the important part): element(by.repeater("project in projects").row(1).column("{{project.name}}")).click().then(function(){ flow.timeout(5000); $('.project-data a').click().then(function () { browser.getallwindowhandles().then(function (handles) { flow.timeout(5000); browser.switchto().window(handles[1]).then(function () { browser.sleep(5000); browser.ignoresynchronization = true; }); there other part in test it's not relevant since error in part. flow this: after clicking link, tab opened, seems switches new tab - , fails , closes window. instead of flow.timeout(5000) use browser.wait so: browser.wait(function() { return handles.length > 1 }, 5000); and instead of second flow.timeout(5000) use: browser.wait(functi...

Swift pattern matching with enum and Optional tuple associated values -

i'm using alamofire , use enum describe api used advised in readme. the endpoints represented follows: public enum api { case getstops(stopcode:string?) case getphysicalstops case getlinescolors case getnextdepartures(stopcode:string, departurecode:string?, linescode:string?, destinationscode:string?) } the optional parameters mutually exclusive: public var urlrequest: nsmutableurlrequest { let result:(path:string, parameters:[string:anyobject]?) = { switch self { case .getstops(let stopcode) stopcode != nil : return ("getstops.json", ["stopcode" : stopcode!]) case .getstops(_): return ("getstops.json", nil) case .getphysicalstops: return ("getphysicalstops.json", nil) case .getlinescolors: return ("getlinescolors",nil) case .getnextdepartures(let stopcode, let...