Posts

Showing posts from February, 2013

Asynchronous Database Problems with Node.js -

i trying query database, running on node server without express using sqlite3, check if element in database. upon finding if element exists, go on access different table information. var username; checksessionid(userssessionid, function(temp) { username = temp[0].username; }); var db = new sql.database("pete's fcrs.db"); var ps = db.prepare("select * users username = ?", errorfunc); ps.all(username, function(err, rows) { if (err) throw err; console.log(rows); }); ps.finalize(); db.close(); function checksessionid(sessionid, callback) { var db = new sql.database("pete's fcrs.db"); var ps = db.prepare("select * sessionids sessionid = ?", errorfunc); ps.all(sessionid, function(err, rows) { if (err) throw err; callback(rows); }); ps.finalize(); db.close(); } ("test: " + sessiondetails); 1) run checksessionid check if sessionid in database, in sessionids table. 2) next, calls callback function, store us...

jasper reports - split text evenly into 2 columns -

i have long text (general sales conditions) , i'm trying figure out how split 2 columns same height. text isn't static, can change whenever needs changed (e.g. customer specific text) , reason can't split manually. using 2 column page format managed let jasper fill 1 column @ time, customer doesn't want 2 columns different heights. can me? i'm using jaspersoft studio 6.0.3. edit: template source <?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ordine" columncount="2" pagewidth="595" pageheight="842" columnwidth="287" leftmargin="10" rightmargin="10" topmargin="10" bottomm...

c++ - Avoid malloc() when doing unordered_map -

try use has map in c++. problem when add constant entry mymap["u.s."] = "washington"; , used malloc() (i verified when using gdb breakpoint on malloc() ). unnecessary calls malloc reduce performance, hence trying avoid as possible. ideas? #include <iostream> #include <unordered_map> int main () { std::unordered_map<std::string,std::string> mymap; mymap["u.s."] = "washington"; std::cout << mymap["u.s."] << std::endl; return 0; } i know malloc necessary when scope of key short, since 1 may need use mymap[key] after key destroyed. in case, keys (a huge number of them) persisitent in memory .

excel - COUNT number of times prior to specified time -

hard sum in subject line. need count of how many times time exists prior specified time. example: column column b 4:00 7:00 4:00 4:00 5:00 6:00 8:00 so need count how many times (column a) have occurred prior time in column b. in above example, there 5 cells in column containing time before time in column b. hopefully makes sense. appreciated! you can try one: =countif(a:a,"<"&b1) tell me if doesn't work.

Running from Cron Python/ Google API will not accept stored Credentials file but from command line it will -

so had thought functioning python script access stored google oauth credentials file. when run: source /metrics/virtualenvs/google/venv/bin/activate; export ld_library_path='/usr/lib/oracle/11.2/client64/lib'; /metrics/googlestats/get_report_2.py it works famously. in python there block check credentials stored file: #get google storage object storage = storage('cred_storage.txt') credentials = storage.get() #check if credentials valid if not send web page new key. if not credentials: flow = oauth2webserverflow(client_id, client_secret, oauth_scope, redirect_uri) authorize_url = flow.step1_get_authorize_url() print 'go following link in browser: ' + authorize_url code = raw_input('enter verification code: ').strip() credentials = flow.step2_exchange(code) storage.put(credentials) mysendmail('re authentication of credentials necessary') exit() all if run same thing local user crontab credentials fai...

How to set custom font to android toolbar's subtitle? -

i want subtitle´s textview in android's toolbar change it's font. i'm doing title, getting on way: field f = toolbar.getclass().getdeclaredfield("mtitletextview"); f.setaccessible(true); titletextview = (textview) f.get(toolbar); i've tried same code trying "msubtitletextview" that's not solution. thanks!! you can subtitle textview this: view subtitleview = toolbar.getchildat(1); if don't add views toolbar, default structure is: [0] - (textview) title [1] - (textview) subtitle [2] - (actionmenuview) menu hope helps!

java - StackOfIntegers Giving Weird Results -

i have issue making code returns prime factorization of integer. know code giving right factors, required use stackofintegers class. the stackofintegers class not seem handle duplicates well. when input 120, prime factors 5, 3, , 2 returned. output missing 2 other 2's. public class test { public static void main(string[] args) { scanner input = new scanner(system.in); system.out.print("enter number: "); int number = input.nextint(); stackofintegers stack = new stackofintegers(1); int factor = 2; while (true) { if (number % factor == 0) { number = number / factor; stack.push(factor); } if (factor > number) { break; } if (number % factor != 0) { factor++; } if (number < 2) { break; } } system.out.println("\nprime fa...

performance - Python: parallelizing any/all statements -

i running python program , i've noticed bottleneck in line doing following all(foo(s) s in l) what wondering - best way make parallel computation? foo(s) thread safe method inspecting s , returning true/false respect criteria. no data structure changed foo. so question is how test in parallel if elements of list l have property foo , exiting 1 element of l not satisfy foo? edit. adding more context. not know kind of context looking in scenario s graph , foo(s) computes graph theoretical invariant (for example average distance or perhaps similar) this sort of depend on foo(s) doing. if i/o bound, waiting on blocking calls, using threads help. easiest way create pool of threads , use pool.map : from multiprocessing.pool import threadpool pool = threadpool(10) all(pool.map(foo, l)) if, however, function cpu bound, using lot of processor power, not you. instead need use multiprocessing pool: from multiprocessing import pool pool = pool(4) all(pool...

How to use image as title and change the color of the text in html -

my background black, want make text white. have code, it's not working. want insert pic, it's still not working. <title color="white">this title</title> thank you. the title tag mandatory html tag defines title of document. not change color or add pictures, more info here. how format text in html: if trying add text page , it's not showing try changing color of text, example: <h1 style="color:white"> title here</h1> how add picture in html: <img src ="address image"/>

AngularJS Child Scope for Element -

i have reusable template called profile.html. looks this: <div> {{firstname}} </div> i have embedded in template bound dedicated controller: <div ng-include src="'templates/profile.html'"></div> i want child $scope created div. in controller parent template, have like: $scope.profile = theprofile; i want child scope profile.html template parent $scope.profile. akin to: <div ng-include src="'templates/profile.html'" ng-scope="{{profile}}"></div> how can this? it looks you're reinventing directives, trying set both template , scope that. also, $scope object large amount of other properties/objects on it, setting object be... problematic. the following create directive merges passed in profile $scope using angular copy, if want way. i'd recommend using $scope.profile, though. .directive('profile', [function(){ return{ templateurl:'template...

PDFTK and removing the XFA format -

are there issues can come of removing xfa format pdf form? i'm using pdftk fill form, , found if forms xfa, pdftk doesn't work unless drop_xfa command first create new template form. 1 thing did notice if didn't drop_xfa, see fields pre-filled on acrobat reader not acrobat pro. other views ubuntu document viewer, fine. don't mind doing drop_xfa checking there might issues me doing forms not aware of. example: if form filled, , it's read on system grab fields/values process. thank in advance. there 3 types of forms in pdf: forms using acroform technology. in case, each field corresponds 1 or more widgets fixed positions on specific pages. form described using nothing pdf syntax. dynamic forms using xml forms architecture (xfa). in case, pdf file nothing container xml file describes whole form. refer dynamic xfa, because form can expand or shrink based on data added: 1-page form can turn 100-page form adding more data. hybrid forms combine acrof...

Can i play track in play.spotify.com? -

my problem is, want search single songs ( or many single songs in array) , echonest return me spotify id in foreign_id. can use spotify_id continue searching desired song in spotify library. in example returns tracks : http://developer.echonest.com/api/v4/song/search?api_key=qr3h8mybuzdytdwub&format=json&results=1&artist=the%20carpenters&title=top%20of%20the%20world&bucket=id:spotify&bucket=tracks {"foreign_release_id": "spotify:album:0rzyzdffrtxvrehqoreiua" , "catalog": "spotify", "foreign_id": "spotify:track:4vdtkwly7revq8voncg43z", "id": "truberv144d15243bc"}, {"foreign_release_id": "spotify:album:3jmq6qzzasytorwvbsrou9", "catalog": "spotify", "foreign_id": "spotify:track:3ng65zhlpdhqrepmbqihbs", "id": "trrimle144d120b851"}, {"foreign_release_id": "spotify:album:5pzgou1yb...

reporting services - SSRS 2005 Deployed / migrated reports do not fill browser -

i copied prod ssrs server database , set dev ssrs server , reports seem function fine, seems work same reports in small box in browser instead of taking full browser. inspecting page reportviewercontrol takes whole page report window small fraction of table. in fact it's table body within table size constrained. i've compared xml on dev reports ones on prod , same. modifications made datasources. there in iis or ssrs determines size of report table in html? was browser issue firefox.

javascript - PascalPrecht angular-translate useUrlLoader -

i'm new both programming , angular. need use angular-translate its' useurlloader, since translations stored in database. $translateprovider.useurlloader('foo/bar.json'); $translateprovider.preferredlanguage('en'); while using staticfilesloader seems enough simple me, since need 2 separate json files translation data, can't useurlloader expects. far understand, expects json includes multiply language translations (both english , german example). can't find example of such file anywhere. the staticfilesloader expects store translations different languages in separate files on server. makes requests this: /your/server/i18n/locale-en.json /your/server/i18n/locale-de.json /your/server/i18n/locale-fr.json where /your/server/i18n/locale- , .json prefix , suffix (respectively) you've passed during configuration. the urlloader expects have 1 "clever" endpoint instead of bunch of files. makes requests this: /your/server/i1...

javascript - How to test for success after calling a AngularJS factory service -

i wondering how check wether or not function successfull or had error. check in function itself. how can recheck result when calling service. i've tried this entryservice.update($scope.entry) .success(function(){ $scope.entry = data; $state.go('entry', {id: $scope.entry._id}); }).error(function(){ error = true; }); this doesn't work. , wondering how similar result? my service funtion looks this: angular.module('academiaunitateapp') .factory('entryservice',function($http){ var service = {}; service.update = function(entry, callback){ $http.put('/api/entrys/' + entry._id, entry) .success(callback, function(data){ console.log('updated entry : ', data); }) .error(callback, function(error){ console.log("couldn't update entry. error : ", e...

tomcat - Deploy WAR file C panel (quick2host) -

i have war file , have deploy server. purchased shared hosting (tomcat shared) quick2host.com. not able deploy war file through c panel. representatives unable send me logs or error. when deployed same war localhost tomcat, it's working fine. the war file build grails war command. project runs on grails. have tried deploy through tomcat admin panel ? please try , let know if getting error logs

animated - Animate CSS not working -

i trying add animate.css website. trying out basic example. <html> <link rel="stylesheet" type="text/css" href="animate.css"> <h1 class="animated infinite bounce">animate</h1> </html> but not working. path absolutely correct. , working in xampp. the link tag has inside head element. <html> <head> <link rel="stylesheet" type="text/css" href="animate.css"> </head> <body> <h1 class="animated infinite bounce">animate</h1> </body> </html>

javascript - Datepicker with jquery with month and years as grid -

i looking use jquery/jquery ui build datepicker, can click on month name in title in calendar view , see grid of month names year name in title, , on (similar windows 7 calendar). is there anyway can use datepicker ui this. (with datepicker, can basic date picker default calendar view.) way can modified add grid of months , grid of years selected from? i have seen in plugin called datepair.js http://jonthornton.github.io/datepair.js/

plot vertical stacking line based on time point in r -

my df this: test id c1 c2 c3 c4 c5 c6 c7 22 112 112 118 121 124 na na b 22 77 89 85 89 88 95 100 c 22 67 85 76 77 77 84 92 d 22 58 81 73 75 79 84 95 c1, c2, c3... represents different time points. each row represents different test in df, student 22 has been tested 5 times on test a, , 7 times on test b,c , d. i intend use ggplot2 create vertically stacked line graph x-axis 4 tests, y-axis scores, , vertical stacking being based on time point. can me? thanks! may helps library(tidyr) library(ggplot2) gather(df, var, val, c1:c7) %>% filter(!is.na(val)) %>% ggplot(. , aes(x=test, y=val, fill=var))+ geom_bar(stat='identity') update these options. df1 <- gather(df, var, val, c1:c7) %>% filter(!is.na(val)) ggplot(df1, aes(x=test, y=val, colour=var))+ geom_area(aes(fill=var), position='stack') or ggplot(df1,...

How to add directory to include path in visual c++? -

this question should trivial enough didn't find answer. have following hierarchy: source.cpp thirdparty include pelib pelib.h test.cpp i need include "pelib/pelib.h" . if add $(projectdir)/thirdparty/include include directories can #include "test.cpp" can't #include "pelib/pelib.h" . according this answer (thanks @umläute) code should work. guess variable $(projectdir) not pointing directory think. try adding full path thirdparty/include include directories , try again.

java - Call method on subclass of imageLoader -

i'm trying call .evictall() on cache of imageloader, can't figure out how access method private volleysingleton(){ mrequestqueue = volley.newrequestqueue(volleyapplication.getappcontext()); mimageloader = new imageloader(this.mrequestqueue, new imageloader.imagecache() { private final lrucache<string, bitmap> mcache = new lrucache<string, bitmap>(10); public void flushlrucache(){ mcache.evictall();}; public void putbitmap(string url, bitmap bitmap) { mcache.put(url, bitmap); } public bitmap getbitmap(string url) { return mcache.get(url); } }); } mrequestqueue = volleysingleton.getinstance().getrequestqueue(); mimageloader = volleysingleton.getinstance().getimageloader(); i've tried casting mimageloader object ((imageloader.imagecache) mimageloader).flushlrucache(); but throws error saying can't cast types. how...

javascript - it says "to read a single character from user and check whether the character is present in the sentence or not?please help me -

var sentence = window.prompt('please enter short sentence describing home',''); var character = window.prompt('please enter single character',''); var count = 0; (var = 0; < sentence.length(); i++) if(sentence.charat(i) == character) // count++; document.write('the character' + character + 'is appearing ' + count + 'times in sentence'); else document.write('character not found.please try again'); get character , sentence , following: var sentence = window.prompt('please enter short sentence',''); var character = window.prompt('please enter single character',''); var count = 0 for(var = 0; < sentence.length; i++){ if(sentence[i] == character){ count+=1; } } if(count > 1){ alert("the character appeared "+count+" times"); //to fix 'one times' }else if(count == 1){ ...

mysql - Join multiple models' subqueries with rails -

i'm trying write below query in rails cleanest , simplest way; select * (select date(logtime) date, sum(case when duration/60 <= 2 1 else 0 end) d_0_2, sum(case when duration/60 > 2 , duration/60 <=5 1 else 0 end) d_2_5, sum(case when duration/60 > 5 , duration/60 <= 10 1 else 0 end) d_5_10, sum(case when duration/60 > 10 , duration/60 <= 15 1 else 0 end) d_10_15, sum(case when duration/60 > 15 1 else 0 end) d_15_9999 session_logs date(logtime) > "2014-04-1" , isclosed = 1 group date(logtime)) l1 left join (select logdate date, potential, conversion, bounce, newcustomers, repeatcustomers, averagetime metrics client_id = 1 , logdate between "2014-01-01" , "2015-05-04" group logdate) l2 on l1.date = l2.date so have 2 models, sessionlog , metric. wrote 2 different queries each of model; metric = metric.select("potential,co...

java - Access restriction on class due to restriction on required library rt.jar? -

i'm attempting compile java 1.4 code created ibm's wsdl2java on java5 without recreating stubs , saw error in eclipse. i'm under assumption stubs created should compile long runtime jars available (they are). access restriction: type qname not accessible due restriction on required library c:\program files\java\jdk1.5.0_16\jre\lib\rt.jar the full classname javax.xml.namespace.qname what going on here? is case trying refactor pig sausage? better off recreating stubs? there's solution works. found on this forum : go build path settings in project properties. remove jre system library add back; select "add library" , select jre system library . default worked me. this works because have multiple classes in different jar files. removing , re-adding jre lib make right classes first. if want fundamental solution make sure exclude jar files same classes. for me have: javax.xml.soap.soappart in 3 different jars: axis-saaj-1.4.jar , sa...

java - Multithreaded string processing blows up with #threads -

i'm working on multithreaded project have parse text file magic object, processing on object, , aggregate output. old version of code parsed text in 1 thread , did object processing in thread pool using java's executorservice . weren't getting performance boost wanted, , turned out parsing takes longer thought relative processing time each object, tried moving parsing worker threads. this should have worked, happens the time-per-object blows function of number of threads in pool . it's worse linear, not quite bad exponential. i've whittled down small example (on machine anyhow) shows behavior. example doesn't create magic object; it's doing string manipulation. there's no inter-thread dependencies can see; know split() isn't terribly efficient can't imagine why sh*t bed in multithreaded context. have missed something? i'm running in java 7 on 24-core machine. lines long, ~1mb each. there can dozens of items in features , , 100k+ it...

getting answer from 5 random multiple choice in php -

Image
i trying build web application generate 5 random question database along 4 possible answers. each question come own id. have stuck when user click submit button, direct result.php page shows number of right answers. dont know how match question id answer in database since there 5 questions @ same time (5 forms). here i've tried far <script> function sender() { document.forms["form1"].submit(); document.forms["form2"].submit(); document.forms["form3"].submit(); document.forms["form4"].submit(); document.forms["form5"].submit(); return true; } </script> <?php include('db.php'); $sql = "select * quizzes order rand() limit 5"; $result = mysql_query($sql); while($data = mysql_fetch_array($result)){ echo ' <form id="form'.$i.'" action="result.php" method="post"> <ta...

Need loop within the java class using TestNG -

i wrote loop if have 1 method, if have multiple method in testng scripts. i able make work if put variable within public class, need run hostnum 2 through hostnum 50. need loop within class while using testng therefore can't use public static main. here code please advise me can do. i'm noob :( package firsttestngpackage; import org.openqa.selenium.*; import org.testng.annotations.*; import org.openqa.selenium.chrome.chromedriver; public class test5 { webdriver driver; //i need loop within class!! //this not working /* { } int hostnum = x;*/ //this not working /* (int x = 1; x <= 2; x++){ int hostnum = x; }*/ //this working no loop :( int hostnum = 2; @test(priority = 1, enabled = true) public void method1() throws exception { system.setproperty("webdriver.chrome.driver", "c:\\chromedriver.exe"); driver = new chromedriver(); driver.get("https:/...

android - GoogleApiClient.addApi() doesn't support Gmail API -

i'm trying use following code authentication given apis addapi neither recognizing gmail api or gmail.api api. because of i'm getting unauthorized 401 going further application when trying retrieve messages. mgoogleapiclient = new googleapiclient.builder(this) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .addapi(plus.api) .addscope(plus.scope_plus_login) .addapi(gmail) .addscope(gmailscopes.gmail_readonly) .build();

javascript - onClick wait for returned value -

this question has answer here: how return response asynchronous call? 24 answers i have links on webpage redirect user pages being logged in required. if user not logged in, want show him modal window message log in. function isloggedin(){ var requirelogincheckstatusurl="require_login.php?check_login=1"; $.get(requirelogincheckstatusurl).done(function(data) { if(data == 2){ var requireloginmodalurl = "require_login.php?ajax=1"; $.get(requireloginmodalurl).done(function(data) { $('body').prepend(data); $('body').addclass('stop-scrolling'); return false; }); } }); return true; } as can see there 2 asynchronous calls in function, need somehow make tag w...

java - Reusing a fragment class inside an activity -

as not familiar fragments getting quite confused solutions presented on stackoverflow. have tried many different techniques achive task: have class called mapfragment extends fragment. works fine inside viewpager. however, want reuse class different activity. heres sample fragment called mapfragment: public class mapfragment extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_mapview, container, false); mapview = (mapview) rootview.findviewbyid(r.id.fragment_mapview); mapview.oncreate(savedinstancestate); this.sethasoptionsmenu(true); activity.getactionbar().setdisplayhomeasupenabled(true); initgps(); initviews(); initlisteners(); bundle extras = getarguments(); string url = ""; if(extras.containskey("url")) url = extras.g...

ios - Arabic input fields in unity -

is there way change language of input fields in unity arabic?. tried arabicsupport , displayed arabic correctly using input fields didn't work because gameobject.find("input_field").getcomponent<inputfield> ().text = fix3dtextcs.fix(gameobject.find("input_field").getcomponent<inputfield>().text); caused error so, if printed input text elsewhere, appear correctly how can same input field? have tried adding arabic font in input. if so, post error message may find bug

Intern tutorial functional test exception -

i struggling run functional tests on intern tutorial. started on intern using intern tutorial @ https://github.com/theintern/intern-tutorial . unit tests fine. when run functional tests using following command. sauce_username=<myusername> sauce_access_key=<mypassword> ./node_modules/.bin/intern-runner config=tests/intern i this; listening on 0.0.0.0:9000 starting tunnel... ready using no proxy connecting sauce labs rest api. error: [post http://(redacted)@localhost:4444/wd/hub/session] connect econnrefused error: connect econnrefused @ exports._errnoexception <util.js:746:11> @ tcpconnectwrap.afterconnect [as oncomplete] <net.js:1000:19> error: [post http://(redacted)@localhost:4444/wd/hub/session] connect econnrefused error: connect econnrefused @ exports._errnoexception <util.js:746:11> @ tcpconnectwrap.afterconnect [as oncomplete] <net.js:1000:19> error: [post http://(redacted)@localhost:4444/wd/hub/session] connect econnrefu...

ios8 - Using NEVPNManager in iOS 8, How can I programatically create VPN connections to custom VPN types? (e.g. Cisco any connect) -

looking @ vpn configuration in apple's configurator tool, offers many different types of vpn, such as l2tp pptp cisco anyconnect juniper ssl check point mobile vpn etc i'd create custom vpn configuration programatically using nevpnmanager , looking @ list of objects added in networkextension framework there 2 protocol classes - nevpnprotocolipsec , nevpnprotocolikev2 . i'm new world of vpn's, question this: are proprietary vpn types (such cisco anyconnect) variations of ipsec or ikev2, , can set them using 1 of protocol classes, or not possible nevpnmanager you can implement own version of vpn via nevpnmanager, can't use set / edit other vpns (such cisco).

math - Python Decimal sum strange behavior -

it must mistake, can't understand going on. here code behavior in cycle value: type of data[name]['money_receive'] vividict class vividict(dict): def __missing__(self, key): value = self[key] = type(self)() return value so data[name]['money_receive'] = decimal(1659605.00) money_receive = data[name]['money_receive'] if data[name]['money_receive'] else decimal(0.0) column_sum = {'money_receive': decimal(0.0)} column_sum["money_receive"] += money_receive print u"%s receive %s" % (money_receive, type(money_receive)) print u"%s receive %s" % (column_sum["money_receive"], type(column_sum["money_receive"])) i this 1659605.00 receive <class 'decimal.decimal'> 1.660e+6 receive <class 'decimal.decimal'> print "%.2f"%column_sum["money_receive"] 1660000.00 but don't understand why. the decimal module rou...

ruby on rails - Get last comments created -

there articles , comments. the goal : list comments posted last on articles. for example: article #1 has 3 comments article #2 has 1 comment article #3 has no comments goal: 2 comments created last on article #1, #2 class article < activerecord::base has_many :comments end class comment < activerecord::base belongs_to :article, counter_cache: true def self.last_comment # list comments created last on article end end class commentscontroller < applicationcontroller def last_comments @last_comments = comment.last_comment end end one way cache last_comment_id on article. class article < activerecord::base has_many :comments, after_add: :update_last_comment, after_remove: :update_last_comment has_one :last_comment, class_name: "comment" private # process asynchronous job def update_last_comment self.last_comment = comments.order(created_at: :desc).first self.save! end end class...

java - How to change theme in app settings -

i working on app in user able pick list of color options in settings (all code shown below). when not change after settings activity. changes when leave activity(say home) , come back. believe because oncreate() not being called, problem if setcontentview () again whole app unresponsive. , if recreate() crashes because of music player (again code below). please leave answer if think work. in advance. code: settingsactivity.java (also cant bar change on one) public class settingsactivity extends preferenceactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); string themename = settings.getstring("theme", "darkblue"); int theme = mythemer.getthemeid(themename); if(build.version.sdk_int > 20){ int themedark = mythemer.getcolorprimarydark(them...

c++ - Why std::is_same does not work? -

my code snippet is: namespace serialization { struct output_stream { ///// void write(const void* data, size_t size) { const byte_t* p = static_cast<const byte_t*>(data); size_t old_size = buffer_.size(); buffer_.resize(old_size + size); memcpy(buffer_.data() + old_size, p, size); } } struct input_stream { /////// void read(void* to, size_t size) { assert(cur_ + size <= end_); memcpy(to, cur_, size); cur_ += size; } } } template <class stream_t> void serialize(not_pod_struct& r, stream_t stream) { if (std::is_same<stream_t, serialization::output_stream>::value) { stream.write(&r, sizeof(r)); } else if (std::is_same<stream_t, serialization::input_stream>::value) { not_pod_struct* buf = new not_pod_struct[sizeof(not_pod_struct)]; s...

actionscript 3 - Move and Scale a MovieClip smoothly between multiple points -

i have set-up of 3 horizontal rows button aligned each of them , character (centered each row) want move between these rows (think of little big planet). able program character moves between 3 rows , has set scale when does, want see character moving between points; not watch teleport location. i've tried can think of: loops, boolean on/off, velocity/distance/difference shenanigans, etc., i'm having no success getting move @ button click , continue moving until reaches point. i'm not sure if can set-up scale incrementally until reaches desired end scale size or not. saw similar problem asked on site, solution gave uses point class , lot of math, , have never had success getting flash use points. suggestions appreciated. package { import flash.display.movieclip; import flash.events.event; import flash.events.mouseevent; public class main_test_5 extends movieclip { private var cam:movieclip = new movieclip(); private var player:playe...