Posts

Showing posts from March, 2014

Unable to extract user_id from google API -

i have working google-app-engine server written in python. http requests handled perfectly, except when try register google-user server, when call users.get_current_user() none in return value. is there need enable on google developer console? the same app can register server exact same api (written other team). thanks in advance,

java parsing of complex string? -

i getting string response server this.. [ anchor{anchorname='&loreal_lip_balm', clientname='loreal india', anchorprice=10, campaigns=[ campaign{ campaignid='loreal_camp1', question='how turn melted lipstick tinted lip balm', startdate=2015-08-04, enddate=2015-08-04, imageurl='null', regioncountry='all', rewardinfo='null', campaignprice=20, options=null } ]}, anchor{ anchorname='&loreal_total_repair_5', clientname='loreal india', anchorprice=125, campaigns=[ campaign{ campaignid='loreal_camp2', question='i...

node.js - Finding logs for crashing application on Bluemix -

i have node.js app crashing , have no idea why. when try access logs 'files , logs' in app dashboard, says 'the application not started, there no files or logs available.'. have no idea why application crashing , logs not available! app.js require('newrelic'); //monitoring var express = require('express');//middleware var app = express(); var cfenv = require('cfenv');// cloud foundry library var appenv = cfenv.getappenv(); app.use(express.static(__dirname + '/public')); app.listen(appenv.port, appenv.bind, function() { console.log("server starting on " + appenv.url); }); applications: - disk_quota: 1024m host: x name: x path: . domain: mybluemix.net instances: 1 memory: 256m thanks help update : took fix upping memory amount. user agent new relic added memory overhead caused hit 256mb limit. to logs crashed app, use command: cf logs <appname> --recent

php - Ajax auto search in codeigniter -

ajax autosearch <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script> <script type="text/javascript"> function ajaxsearch() { alert('hai'); var input_data = $('#search_data').val(); alert(input_data); $.ajax({ type: "post", url: "search/auto_search", data: {search_data:input_data}, success: function(data1) { alert(data1); // return success if (data1.length > 0) { $('#suggestions').show(); $('#autosuggestionslist').addclass('auto_list'); $('#autosuggestionslist').html(data1); } } }); } </script> controller public function ...

java 8 - JAXB (RI) libraries vs. JDK -

using maven, there couple of plugins support e.g. generation of jaxb classes xsd, e.g. org.codehaus.mojo:jaxb2-maven-plugin , org.jvnet.jaxb2.maven2:maven-jaxb2-plugin. newest version of have dependencies e.g. org.glassfish.jaxb:jaxb-xjc , org.glassfish.jaxb:jaxb-runtime (in version 2.2.11). but wonder happen if used generate classes xsd use jdk 8 (which contains version 2.2.8) @ runtime: wouldn't there risk runtime errors? so necessary or recommended use jaxb-runtime corresponding jaxb-xjc version used generate classes xsd? of course override dependencies jaxb-xjc etc. , explicitly use version 2.2.8. wonder if same result if used jdk 8 xjc tool directly? you have 3 phases: (1) generation of schema-derived code (2) compilation of schema-derived code (3) runtime the important jaxb api use compile (2) compatible jaxb api use in runtime (3). if not case might compile code uses annotation later not available in runtime. , you'll see error first in runtime....

Optimization of a C++ code (that uses UnorderedMap and Vector) -

i trying optimize part of c++ code taking long time (the following part of code takes 19 seconds x amount of data, , trying finish whole process in less 5 seconds same amount of data - based on benchmarks have). have function "add" have written , copied code here. try explain as possible think needed understand code. please let me know if have missed something. the following function add called x times x amount of data entries. void hashtable::add(pointobject vector) // pointobject user-defined object { int combinedhash = hash(vector); // function "hash" takes less 1 second x amount of data // hashtablemap unordered_map<int, std::vector<pointobject>> if (hashtablemap.count(combinedhash) == 0) { // if hashmap not contain combinedhash key, // add key , new vector std::vector<pointobject> pointvectorlist; pointvectorlist.push_back(vector); hashtablemap.insert(std::make_pair(combinedh...

php - How to update the cache value when database has change value of same data which is stored in cache -

if using laravel 4.2 caching mechanism bellow. $users = db::table('users')->remember(10)->get(); as understand cache mechanism query execute one's , story it's value cache , return data cache upto 10 minutes. but problem one's query executed , data stored it's cache inbetween user table updates it's value how may check , update cache value can updated data. any 1 have idea suggestion please let me know...? if using supported cache driver , can add tags caches: $users = db::table('users')->cachetags(array('people', 'authors'))->remember(10)->get(); then when value updated, can flush cached values under tag. example, in user model add: public function save(array $options = []) { $result = parent::save($options); if ($result) { cache::tags(array('people', 'authors'))->flush(); } return $result; }

asp.net mvc - how to be sure its parallel in c# -

this code have written days, want know running in parallel . part of controller in mvc code. namespace newsreader.controllers { public class testcontroller : controller { public async task<actionresult> index() { using (var db = new applicationdbcontext()) { var categorylist = db.categories.select(item => item.name).tolist(); var khabaronline = khabaronlinetask(categorylist); var isna = isnatask(categorylist); await task.whenall(khabaronline, isna); var newslist = new list<newsdetail>(); newslist.addrange(khabaronline.result); newslist.addrange(isna.result); return view(newslist); } } public task<list<newsdetail>> khabaronlinetask(list<string> categorylist) { var ac = new agenciesclass(); return task.run(() => ac.k...

python - Randomized contraction algorithm for the Min Cuts in a graph -

i have tried write implementation of karger's algorithm solving min cut problem. here's code def randomvertices(g): v1 = g.keys() [random.randint(0,len(g)-1)] v2 = g[v1] [random.randint(0,len(g[v1])-1)] return v1, v2 def mergevertices(g): v1,v2 = randomvertices(g) g[v1].extend(g[v2]) x in g[v2]: l = g[x] in range(0,len(l)): if l[i] == v2: l[i] = v1 while v1 in g[v1]: g[v1].remove(v1) del g[v2] def mincut(g): while len(g) > 2: mergevertices(g) return len(g[g.keys()[0]]) it's not commented should pretty self-explanatory. 'g' dictionary keys vertices of graph, each values vertices connected to. randomvertices gives me edge want contract, while mergevertices updates dictionary (and hence graph) deleting second vertex, updating values of keys linked vertex, , getting rid of self-loops. looks okay me if run on test graph keyerror @ l = g[x] s...

javascript - Creating a new class more than once -

i have various javascript classes. a class created so: this.user = new app.user(); my question is, if call above again , again , again (every time open modal) there memory issues? old class replaced new copy assigning same user var? need consider? try create empty list type of class , every time create new instance class initialize last index undefined object :) this manage classes :)

Iterate over json array in Go to extract values -

i have following in json array (conf.json file). { "repos": [ "a", "b", "c" ] } i attempting read json , iterate on stuck. new go (and programming) having hard time understanding happening here. import ( "encoding/json" "fmt" "os" ) type configuration struct { repos []string } func read_config() { file, _ := os.open("conf.json") decoder := json.newdecoder(file) configuration := configuration{} err := decoder.decode(&configuration) if err != nil { fmt.println("error:", err) } fmt.println(configuration.repos) } so far far have been able get. print out values okay, [a, b, c] . what able iterate on array , split out each value individually have not had luck @ doing this. taking wrong approach this? there better way this? you mean this: for _, repo := range configuration.repos { fmt.println...

ios - How to set button image to nil in Swift? -

in reset button want reset game when try set image nil xcode displays error: could not cast value of type 'uiview' (0x106c26e88) 'uibutton' (0x106c2cf68). this code: var button : uibutton var = 0; < 9; i++ { button = self.view.viewwithtag(i) as! uibutton button.setimage(nil, forstate: .normal) } you can insert nil image button let btncheckmarkimage = uiimage(cgimage: nil) checkboxbtn.setimage(btncheckmarkimage, forstate: uicontrolstate.normal)

meteor - Meteorjs link social media accounts -

i'm attempting use bozhao:link-accounts package atmosphere, no luck. rather linking accounts, creating additional accounts. here implementation looks like: packages added: meteor add accounts-facebook meteor add accounts-twitter meteor add bozhao:link-accounts meteor add service-configuration <!--/client/signin.html--> <template name="signintmpl"> <button class="btn btn-facebook">sign in facebook</button> </template> <!--/client/linktweets.html--> <template name="linktweetstmpl"> <button class="btn btn-twitter">connect twitter account</button> </template> //client/signin.js template.siginintmpl.events({ 'click .btn-facebook': function() { meteor.loginwithfacebook({requestpermissions: ['email']}, function(err) { //do if conditional ... }) } }) //client/linktweets.js template.linktweetstmpl.events({ 'click .btn-twitte...

php - Creating a custom CSV importer for SilverStripe -

i'm working on building custom import control silverstripe site because csv files going used unfortunately not formatted csv files , cannot improved (we have work we're given, basically). files contain semi-color separated data, , each line 1 entry: "[id]";"[first name]";"[middle initial]";"[last name]";"[title]";"[university/college]";"[specialty]";"[graduation date]" any of values empty (i.e. entry may not have middle initial or may not have speciality listed). these fields marked single space within pair of double quotes: "[id]";"[first name]";" ";"[last name]";"[title]";"[university/college]";" ";"[graduation date]" it's important note csv files not have headers, , unlikely able have them. have read csvbulkloader class silverstripe, seems that, without headers, difficult make use of it. plus, there is...

lua - Event.target collides only once, not multiple times -

when run oncollision function, seems collides 'ground' multiple times, though not moving. how can make once object hits ground, collides 'once'? i give 'score' every time hits ground, because hits ground multiple times, score seems keep going up. here part of code: function playercollision( self, event ) if ( event.phase == "began" ) --if hit bottom column, u points if event.target.type == "player" , event.other.type == "bottomcolumn" print ("hit column") onplatform = true else --if hit else, gameover --composer.gotoscene( "restart" ) print ("hit ground") end end end i didnt find wrong code, try add statement, hope may work. function playercollision( self, event ) if ( event.phase == "began" ) --if hit bottom column, u points if event.target.type == "player...

python - Uploading a file to a Django PUT handler using the requests library -

Image
i have rest put request upload file using django rest framework. whenever uploading file using postman rest client works fine: but when try code: import requests api_url = "http://123.316.118.92:8888/api/" api_token = "1682b28041de357d81ea81db6a228c823ad52967" url = api_url + 'configuration/configlet/31' #files = { files = {'file': open('configlet.txt','rb')} print url print "update url ==-------------------" headers = {'content-type' : 'text/plain','authorization':api_token} resp = requests.put(url,files=files,headers = headers) print resp.text print resp.status_code i getting error on server side: multivaluedictkeyerror @ /api/configuration/31/ "'file'" i passing file key still getting above error please let me know might doing wrong here. this how django server view looks def put(self, request,id,format=none): configlet = self.get_object(id) configl...

node_module errors with AWS lambda, what's the best practice for dependcies? -

i've been trying convert , deploy 1 of our node.js apps lambda function , have been having problems node_modules dependencies - saying can't find modules. started creating package.json, npm install dependencies locally copy node modules folder lambda. for instance have project requires sequelize , convict , have been getting errors saying cannot find moment module sub-dependency. see moment included in root of node_modules not included in sub folder under sequelize module. however, project runs fine locally. difference in lambda , what's best practice deploying long list of node modules - copy of node_modules folder? on of other simpler projects have, small amount of node_modules can copied no problems. { "errormessage": "cannot find module 'moment'", "errortype": "error", "stacktrace": [ "function.module._resolvefilename (module.js:338:15)", "function.module._load (module....

bash - docker automatically commit and push -

i'm trying setup gui application in docker use on different computers exact same configuration. container working have commit , push changes manually. is there way automatically commit , push changes of docker container after container stopped (by closing application). thanks helping, flo i don't know of tool automatically, write one. docker emits events when containers stop, have process subscribes events (or cron job polls them) , when detects closed container (maybe own naming convention?), automatically docker commit , tag. the events available via docker events ( docs ), , docker remote rest api .

foreach loop with DOMDocument on PHP -

this code doesn't out thing, 0 . <?php $html = '<a href="abc" >hello world!</a><a href="abcdef" >hello </a>'; $html = '<div>' . $html . '</div>'; $doc = new domdocument; $doc->loadhtml($html); $links = $doc->getelementsbytagname('a')->item(0); foreach ($links $link){ echo "0"; echo $dom->savehtml($link->getattribute('href'); } // outputs: "<h1>hello world!</h1>" ?> you have drop ->item(0) following getelementsbytagname call or first anchor element in $links (which why foreach not want to). savehtml call have removed. $html = '<a href="abc" >hello world!</a><a href="abcdef" >hello </a>'; $html = '<div>' . $html . '</div>'; $doc = new domdocument; $doc->loadhtml($html); ...

asp.net mvc - add data to my html mvc part -

it such have add data-val used birthday indicating when have fødelsedag. have check add plain html mvc html part, have tried this. it causes problems @ 2 using data-* , can not pardon enter it. @html.textbox("txtfornavn", null, new { @class = "form-control input-lg", placeholder = "fornavn", data-val="true", data-val-required="date required", type = "date" }) normally, html part this. <input type="date" class="form-control input-lg" data-val="true" data-val-required="date required"> i have written here, , works fine out problems.¨ @html.textbox("txtfornavn", null, new { @class = "form-control input-lg", placeholder = "fornavn", type = "date" }) i have try here: html5 data-* asp.net mvc textboxfor html attributes the link posted gave answer. have use underscore _ if want use dashes in ...

ckeditor - CKEdtior less than sign (<) is not shown after saving -

i using redmine installation ckeditor plugin. started document our work in wiki. 1 problem commands not shown correctly after saving. for example, write: mysql -u root -p bitnami_redmine < backup.sql but after saving page, less-than sign , after gone: mysql -u root -p bitnami_redmine what can correct behavior?

validation - Has the hash password function changed in magento? If so, to what? -

i using magento version 1.9.0.1. for switching magento purposes need create login function customers outside magento framework. i have looked method magento uses hash , validate passwords, method doesn't seem work anymore. below code use validate user login outside magento. code try proof of concept , not being used in live environment obvious reasons :). function checkpassword($entity,$passwordinput){ $query = mysql_query("select value customer_entity_varchar entity_id = '$entity' , attribute_id = '12' limit 1"); $fetch = mysql_fetch_object($query); $fetch_data = explode(':',$fetch->value); $hashed_password = $fetch_data['0']; $salt = $fetch_data['1']; $hashinput = md5($passwordinput . $salt); if($hashinput == $hashed_password){ return 'success'; } else{ return 'failure'; } } $entity entity_id passed after email validation, $passwordinput ...

Stopping a Kernel thread using a timer in linux -

i trying stop kernel thread calling kthread_stop() inside function called timer.when load module kernel, kthread starting , stopping after specified time mentioned in timer giving error message in log. can me solve problem new kernel thread programming.this code #include <linux/kernel.h> #include <linux/module.h> #include <linux/timer.h> #include <linux/kthread.h> #include <linux/sched.h> module_license("gpl"); struct task_struct *task; static struct timer_list my_timer; int thread_function(void *data) { printk(kern_alert"in thread function"); while(!kthread_should_stop()){ schedule(); } printk(kern_alert"after schedule\n"); return 1; } void my_timer_callback( unsigned long data ){ printk( "my_timer_callback called (%ld).\n", jiffies ); printk(kern_alert"thread stopped\n"); kthread_stop(task); } int init_module( void ){ int ret; printk("timer module installing\n")...

PHP WebSocket – How send message to specified client? -

sending messages clients looks this: function send_message($msg) { global $clients; foreach($clients $changed_socket) { socket_write($changed_socket, $msg, strlen($msg)); } return true; } how can send message specified client, example client #2? $clients array looks this: array ( [0] [1] [2] [3] ) instead of running foreach loop send messages every client, send 1 want. function send_message($msg) { global $clients; socket_write($clients[2], $msg, strlen($msg)); return true; }

java - BitmapFactory Not working in Android -

this line of code returns null after cropping: this.bmp = bitmapfactory.decodefile(this.imagefileuri.getpath()); this crop method: private void performcrop() { this.imagefileuri = uri.fromfile(this.file); intent var1 = new intent("com.android.camera.action.crop"); var1.setdataandtype(this.imagefileuri, "image/*"); system.out.println(this.imagefileuri.getpath()); var1.putextra("crop", "true"); var1.putextra("scale", true); var1.putextra("return-data", true); // var1.putextra("output", this.imagefileuri); intent.putextra(mediastore.extra_output, this.imagefileuri); this.startactivityforresult(var1, 1); } i have tried using custom method return bitmap still returns null. method public static bitmap decodefile(string path) { int orientation; try { if (path == null) { return null; } //...

javascript - Any way to get nearby html nodes different from current node's tag name in NodeJS? -

let's have following html code.. <html> <head></head> <body> <div> <input type ="text"> <img src = "pic.jpg"> <a href ="index.html">home</a> </div> </body> </html> and want @ nodes around element that's on same level. example, above html code, possible like... $("input").returnnodesonsamelevel() and can return list of nodes here contain [< input...>, < a...> ] ? i'm using nodejs's request module grab page source , using cheerio parsing. sibling() returns nodes of same tag name makes sense. if there's better module or way this, please let me know. thank you. if $("input").siblings() doesn't work, try: $("input").parent().children()

ios - No visible @interface for 'JSQSystemSoundPlayer' error -

i added files: jsqsystemsoundplayer.h jsqsystemsoundplayer.m into project , rose next error: no visible @interface 'jsqsystemsoundplayer' declares selector 'playalertsoundwithfilename:fileextension:' i searched lot could'n find solution. can know how solve it? this declaration of method - (void)playalertsoundwithfilename:(nsstring *)filename fileextension:(nsstring *)fileextension completion:(nullable jsqsystemsoundplayercompletionblock)completionblock; you're missing completion block, there no such method 2 parameters here example how use it [[jsqsystemsoundplayer sharedplayer] playsoundwithfilename:@"mysoundfile" fileextension:kjsqsystemsoundtypeaif completion:^{ // completion block code }]; ed...

angularjs - method does not exist when calling spyOn -

i'm trying use jasmine spyon call angularjs controller function. keep getting following error: submit() method not exist. what missing in order work? describe('myctrler', function() { beforeeach(module('mymodule')); var scope,ctrl; beforeeach(inject(function($rootscope, $controller) { scope = $rootscope.$new(); spyon(scope, "submit"); ctrl = $controller('myctrler', { $scope: scope }); })); it('controller defined', inject(function() { expect(ctrl).tobedefined(); })); it('controller function', function() { expect(submit).tobedefined(); }); }); angular.module('mymodule').controller('myctrler',function($scope){ var vm = this; vm.submit = function() { }; }); as per question missed bind method scope. need make below. hope helps. it('controller function', function() { ...

Fonts in an Android Wear redlines spec provided in pt, but how to conver to sp or dp values? -

i've been given redlines design doc android wear app font sizes have been specified in pt. if text size in wear layout.xml should specified in dp (or should sp?) how convert spec values in pt equivalent in dp wearable app? note, i've seen posting what difference between "px", "dp", "dip" , "sp" on android? , others didn't me know how proceed. conversion between different units follows same on other android device. sp vs dp, font size, use sp can scaled correctly if user changes global font size setting.

Is there any API to fetch the battery status information into a windows 8.1 application -

you cannot vote on own post 0 we developing windows 8.1 application, need show user current battery status on device. since our application running in access mode, user not allowed open charms bar , check device battery status. can please us, if such api present in windows 8.1 fetch battery status details of device? is there other way retrieve information , display user inside our application? i think looking battery class

sql server - Migrating from MSSQL to MYSQL error 1064 MYSQL Workbench -

i preparing migration mssql mysql using mysql workbench. the error receiving follows. error: error executing 'create table if not exists `dbo`.`vendorgtg` ( `vid` int not null comment '', `attending` tinyint(1) null default 0 comment '', `name1` varchar(50) null comment '', `name2` varchar(50) null comment '', `inserted` timestamp null default current_timestamp comment '', `nametag` tinyint(1) null default 0 comment '', primary key (`vid`) comment '')' have error in sql syntax; check manual corresponds mysql server version right syntax use near 'comment '')' @ line 8. sql error: 1064 mysql doesn't have schemas sql server, remove code: create table if not exists vendorgtg ( `vid` int not null comment '', `attending` tinyint(1) null default 0 comment '', `name1` varchar(50) null comment '', `name2` varchar(50) null comment '', `in...

Importing modules in python script and figuring out layout of directory/package -

i new python...and have been reading around trying figure out better answer... still struggling. i trying import script code talking each other. i've tried importing suggested via python documentation: from somepackage.somefile import object the actual directory looks this foo/ ├── bin │ ├── readme.txt ├── setup.py ├── development.ini ├── somepackage │ ├── somefile │ │ ├── __init__.py │ │ ├── object.py │ ├── __init__.py do need import in .py file with? each module has empty init .py file. should move program located? any appreciated!! i figured out issue! need create setup.py document created packages , modules! setup( #contents packages=['somepackage', 'somepackage.someotherpackage'], py_modules=['somepackage.module.file.py'], scripts=['bin/somescript-cmd'], #more code...

Consistent off by one errors in go io.copy function for large content -

this 1 works consistently. _, err = io.copy(out, resp.body) if err != nil { errlog.fatal(err) } this 1 gives pretty consistent off 1 errors (the last byte of downloaded content left off, in case closing ] in json response) large-ish responses (mbs). if _, err := io.copy(out, resp.body); err != nil { errlog.fatal(err) } from the examples on official golang blog , looks should valid syntax. edit: more details , context this error 2nd version of code (more compact error handling) error: 2015/08/05 08:09:31 pull.go:257: unexpected end of json input from code in function err = json.unmarshal(dat, &all_data) if err != nil { return err } i found off 1 issue looking @ first 10 , last 10 characters of file in each case. here before , afters: # before (with error) start: [{"tags":[ end: ersion":1} start: [{"_create end: "tags":[]} # after start: [{"tags...

r - How to graph top most important categories among 25 with stacked bar chart -

Image
my problem bit more complicated 1 this question . i wanted stack 10 abundant species per each rot.herb (18 of them in total) , group other species 2 big categories, other monocots , other dicots. think need manually assign monocot dicot. tricky part 10 abundant species group unique every rot. herb. here graph of stacked: and here code: weedweights<-weeds%>% select(-ends_with("no"))%>% gather(key=species, value=speciesmass, digsawt:pollawt)%>% mutate(realmass=speciesmass * samplearea.m.2.)%>% group_by(rot.herb, species)%>% summarize(avgrealmass=mean(realmass, na.rm=true))%>% filter(avgrealmass != "nan")%>% ungroup() ggplot(weedweights, aes(x=rot.herb, y=avgrealmass, fill=species))+ geom_bar(stat="identity") you can see data here structure(list(rot.herb = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 3l, 3l, 3l, 3l...

javascript - append input box on double click -

append text box shape on double click. right now, appending textbox appending @ 0,0 coordinates of window after using inline styles function dragend(d) { var self = d3.select(this); // first time i'm dragged? // replace me new 1 if (self.classed('initialdragcircle')) { // append new inital draggable createinitialdrag(); self.attr('class', 'dragcircle'); } else if (self.classed('initialdragrect')) { // append new inital draggable createinitialdrag(); self.attr('class', 'dragrect').transition().attr("width", 111).attr("height", 71) self.on('dblclick', function () { ...

sql server - If condition on Selecting XML node in SQL -

i trying read xml , storing in sql server. declare @xml xml set @xml = '<report> <personal> <search> <subject> <name>searchname</name> </subject> </search> </personal> <personal> <search> <subject> <name>searchname</name> </subject> </search> <result> <history> <name>historyname</name> </history> </result> </personal> </report> ' what trying here - selecting name condition here if <personal> contains <result> select name under history/name if <personal> doesn't contain <result> select name under subject/name currently selecting names personal/subject below: select a.search.value('(subject/name)[1]','var...

javascript - Preventing Jade from adding an assignment clause in an HTML element -

i want define local variable in input tag angular 2 application: input(#sometext) button((click)="addtechnology(sometext.value)") add the output expecting is: <input #sometext/> <button (click)="addtechnology(sometext.value)">add</button> however real output (notice additional ="#sometext" ): <input #sometext="#sometext"/> <button (click)="addtechnology(sometext.value)">add</button> this way, angular 2 throws following error, due ="#sometext" : cannot find directive exportas = '#sometext' error: cannot find directive exportas = '#sometext' @ new baseexception (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:7248:25) @ _finddirectiveindexbyexportas (https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12454:13) @ https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js:12435:22 @ map.foreach (native) @ function.execute.map...

Accelerating for loops with list methods in Python -

i have loops in python iterates 2.5 million times , it's taking time result. in js can make happen in 1 second python in 6 seconds on computer. must use python in case. here code: in xrange(k,p,2): arx = process[i] ary = process[i+1] j in xrange(7,-1,-1): nx = arx + dirf[j] ny = ary + dirg[j] ind = ny*w+nx if data[ind] == e[j]: process[c]=nx c=c+1 process[c]=ny c=c+1 matrix[ind]=1 here lists code: process = [none] * (11000*4) it's items replaced integers after it's assignment. dirf = [-1,0,1,-1,1,-1,0,1] dirg = [1,1,1,0,0,-1,-1,-1] e = [9, 8, 7, 6, 4, 3, 2, 1] the data list consists of 'r' informations pixels of rgba image. data = imgobj.getdata(0) how can boost this. doing wrong? there o...

sql server - Get Total on SQL Dynamic (Calendar) Pivot Tables -

i trying sql server dynamic pivot table work allows me count , sum number of columns. purpose of pivot table create report of days individuals staying in city , total number of days(in month). so, example, person staying everyday in june - total 30.person b started staying on 3rd of june - total 27 etc. data table consists of name, arrivedate, departdate...the days of month created through sql query. +------+------------+------------+-------+-------+-------+-----+-------+-------+-------+ | name | arrivedate | departdate | 06-01 | 06-02 | 06-03 | ... | 06-29 | 06-30 | total | +------+------------+------------+-------+-------+-------+-----+-------+-------+-------+ | | 2014-06-01 | 2014-06-23 | 1 | 1 | 1 | ... | 1 | 1 | 30 | | b | 2014-06-02 | 2014-06-23 | 0 | 1 | 1 | ... | 1 | 1 | 27 | | c | 2014-06-02 | 2014-06-23 | 0 | 0 | 0 | ... | 1 | 1 | 16 | +------+------------+------------+-------+----...

How to define default implementation in subclass definition in Haskell? -

i new comer of haskell , following question: given class: class myclass foo :: -> [a] then have subclass more specific: class (myclass a) => subclass foo param = [bar param] bar :: -> but doesn't work expected. expecting default implementation setup in definition of subclass doesn't. need define instance myclass seperately, sounds stupid. how can achieve default implementation when know subclass satisfies property definitely? more specifically, want express in haskell, when class satisfies properties, functions parent can have default implementation . in example, subclass has property bar such know foo defined in such way. a more general form of question is, idea reuse using classes , instances? i found post: inclusion of typeclasses default implementation in haskell it's quite close, still not answering question totally , forms little bit different. elaborating on daniel's answer: suppose have new datatype myda...

Windows Form application C# stops responding in between timer tick events -

i have code in have started timer tick event of 75 sec. application supposed perform task, @ time interval of 75 sec. application runs fine 5 hrs, of sudden shows not responding...whenever other operations done on computer opening other files... my code looks this: private void button2_click(object sender, eventargs e) { tmrtimer.enabled = true; } private void tmrtimer_tick(object sender, eventargs e) { //do stuff here; } i think maybe because used timer system.windows.forms.timer class. kind of timers single thread timers; means use same thread ui use. so, it's obvious why application shows not responding when thread has lots of things do. suggest change timer type , try one: system.threading.timers .

seo - Google Rich Snippets Not Working -

i'm working on website friend (www.texasfriendlydds.com) , trying give them edge rich snippets google allegedly loves. it's defensive driving school 10 locations in austin area. i've placed schema.org code within address of each location, while searching 'defensive driving austin' - not see of locations listed. have 10 of following code each location(different address each): <div itemscope itemtype="http://schema.org/localbusiness"> <span itemprop="name">texas friendly defensive driving</span><br /> <div itemprop="address" itemscope itemtype="http://schema.org/postaladdress"> <span itemprop="streetaddress">13201 ranch road 620</span><br /> <span itemprop="addresslocality">austin</span> <span itemprop="addressregion">tx</span> <span itemprop="postalcode">78750</span> </di...

VBA Excel; Finding Duplicate Cells and Populating an Offset Cell -

i creating automated system reads data wirelessly transmitted data excel. data sends gauge number , value ex. 89,-.002 (gauge #89, value=-.002). data goes cell f2. have created code separates the gauge number , value variables. have list of fixed gauge numbers in cell c5-c11 , readings populate offset in cells g5-g11 based on gauge number. haven't been able figure out how take readings same gauge multiple reading if needed check multiple spots on part. example if there 3 different readings needed gauge 87 ( 87 listed 3 times in c5-c11), need code search 87 based off gauge number variable input in f2 , find 87's in cells c5-c11. check if cell offset 4 columns has value already. if move on next 87 found , check if offset on 1 has value. if doesn't populate cell. i can't hard code numbers in because creating template. have search multiples gauge numbers believe. any or ideas appreciated. better if can give me sample code integrate project. set wsinput = sheet1 ws...

php - Download file from cloud disk (S3) with Laravel 5.1 -

Image
i'm having problems generating file download response in laravel 5.1 while trying download file amazon s3. this controller action: /** * @param getrequest $request * @return \symfony\component\httpfoundation\response */ public function get(getrequest $request) { $fileentry = $this->filerepository->find(); $file = storage::disk('s3')->get('projects/'.$fileentry->project.'/'.$fileentry->name); return $this->responddownload($file, $fileentry->name, $fileentry->type); } and responddownload method: /** * respond file download. * * @param $filecontent * @param $filename * @param $mime * @return \symfony\component\httpfoundation\response */ public function responddownload($filecontent, $filename, $mime) { return (new response($filecontent, 200)) ->header('content-type', $mime) ->header('content-disposition', 'attachment; filename="'.$filename.'...

c++ - Validation of Iterator -

i working in c++03 project. , i'm taking iterator template. need assert iterator references specific type. does c++ provide me way beyond writing own struct validation? what want equivalent of c++14 functionality: static_assert(is_same<iterator_traits<inputiterator>::value_type, int>(), "not int iterator"); since it's c++03 assume i'll have use assert , that's fine if it's runtime debug check need check there. c++03 doesn't come static_assert -type thing, that's c++11 feature. however, there's boost_static_assert . if boost not available you, straightforward thing write: namespace detail { template <bool > struct my_static_assert; template <> struct my_static_assert<true> { }; template <size_t > struct my_tester { }; } #define my_static_assert(b) \ typedef ::detail::my_tester< sizeof(::detail::my_static_assert< ((b) == 0 ? false : true) >)> \ my_stat...