Posts

Showing posts from January, 2012

python - Getting TypeError: type() argument 1 must be string, not None -

i getting error while installing customized odoo module. here full traceback getting. when clicking install button on module kanban view. traceback (most recent call last): file "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 518, in _handle_exception return super(jsonrequest, self)._handle_exception(exception) file "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 539, in dispatch result = self._call_function(**self.params) file "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 295, in _call_function return checked_call(self.db, *args, **kwargs) file "/home/software/ws/bma8_dev/odoo/openerp/service/model.py", line 113, in wrapper return f(dbname, *args, **kwargs) file "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 292, in checked_call return self.endpoint(*a, **kw) file "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 759, in __call__ return self....

vb.net - COM Error in ADODB connection -

in console application have simple database connectivity code. shows com exception error in adodb.connection line. module module1 sub main() dim cn new adodb.connection() //error cn.connectionstring = "provider=sqloledb;server=localhost;database=northwind;uid=<username>" cn.open() end sub end module i added microsoft activex data objects 2.8 library in reference,but error appeared. changes library microsoft activex data objects 6.0 library, still shows error. when run applicaiton first shows 1 error- the procedure entry point _loadversionedresourceex@16 not located in msdart.dll. and com exception unhandled: retrieving com class factory component clsid {00000514-0000-0010-8000-00aa006d2ea4} failed due following error: 8007007f specified procedure not found. (exception hresult: 0x8007007f). im using windows 7, visual studio 2010, vb.net probably have obsolete msdart.dll file in ...

php - wordpress - add author picture on top of the post image -

i working in custom theme in wordpress. 1 of pages "solutions_page", displays post category "solutions", featured image, title , text. on top of featured image, need add circle picture of author. here problem, don't know or how it. thinking should put div position absolute featured image, , make circle. how can if not have featured image in code? here single.php, not doing job not see div picture: <?php get_header(); ?> <div class="container"> <?php if (have_posts()) { while (have_posts()) { the_post(); if (in_category('solutions')) { the_content(); ?> <div class="authorcircle"> <img src="images/jules.jpg" alt=""/> </div> <?php } else { the_content(); } } // end while } // end if ?> </div...

Randomly Sample entries of a matrix and return the (Row, Column) Indexes in R? -

i have matrix m rows , n columns. need randomly sample different locations in these matrix , return row indexes , col indexes. my approach: say, want sample 30 percentage of entries in matrix. then, iterate through whole matrix, @ each point, toss biased coin heads of 30 percent probability , select location if heads comes. since, data large, approximately selects 30% of entries. however, observe slow. there way speed up? or better way it? if m matrix, try: arrayind(sample(length(m),0.3*length(m)),dim(m)) an example: set.seed(1) m<-matrix(ncol=6,nrow=6) arrayind(sample(length(m),0.3*length(m)),dim(m)) # [,1] [,2] #[1,] 4 2 #[2,] 2 3 #[3,] 2 4 #[4,] 6 5 #[5,] 1 2 #[6,] 4 5 #[7,] 5 5 #[8,] 4 6 #[9,] 6 3 #[10,] 2 1

w3c - How is "<" in HTML handled by browsers? -

in following snippet, < gets rendered expected in firefox 37.0.2 , have seen same in many other modern browsers well. textarea specification valid html5? ideally shouldn't &amplt; escaping "<" <html> <textarea> hello world < </textarea> </html> how html parsers distinguish between tag open , "<"? browsers lot handle errors automatically guessing, 1 such case? the reason interested in because when use wysiwyg editors in web apps - save html editors source mostly. when template frontend, behaviour makes not mandatory html quote stuff backend. works without html quoting can cause undesired effects freezing / infinite loop's atleast tinymce editor's 3.5.8 version. this indeed guessing. proper way use literal < in html use &lt; (and &gt; > ). that said, textarea bit specific in can never contain other html elements - parser can sure meant literal < , not starting tag. of cours...

C write data after 1024 lines in a csv file -

i trying write data in csv file per 1024 lines: fprintf(fp, "%f %f \1024n", a, b) what right way write per 1024 lines? first of have use loop: int i=0; for(i=0; i<1024;i++) { fprintf(fp, "%f %f\n", a, b); } secondly add semicolon between values. grants csv opened automatically excel dividing values in colums: int i=0; for(i=0; i<1024;i++) { fprintf(fp, "%f;%f\n", a, b); } edit leave 1024 empty lines can int i=0; fprintf(fp, "%f;%f\n", a, b); // print nd b values // loop write 1024 empty lines for(i=0; i<1024;i++) { fprintf(fp, "\n"); }

sql - SELECT Top 1 ID, DISTINCT Field -

i have table sample table follows: id | city -------------- 1 | new york 2 | san francisco 3 | new york 4 | los angeles 5 | atlanta i select distinct city , top id each. e.g., conceptually following select top 1 id, distinct city cities should give me: id | city -------------- 1 | new york 2 | san francisco 4 | los angeles 5 | atlanta because new york appears twice, it's taken first id 1 in instance. but error: column 'cities.id' invalid in select list because not contained in either aggregate function or group clause. try way: select min(id), city cities group city min function used choose 1 of id 2 new york cities.

javascript - Jquery click function not working for the button inside popover -

i trying alert message when clicked on button id tagit . whole form appearing in bootstrap popover. added jquery alerting message,but not showing alert dialog boxes,but when call same thing in javascript showing alert. need in jquery. how can this? var htmlcont ='<table class="pop-table"><tr><td><button class="btn btn-warning" id="tagit">filter</button></td></tr></table>'; $('[data-toggle="popover"]').popover({content: htmlcont, html: true}); $("#tagit").click(function(){ alert("hello working"); }); you need use event delegation , so $(document).on('click', "#tagit", function() { console.log("hello working"); });

javascript - Array.sort correction -

i wondering if doing array sort correctly because i'm doing leaderboard display score highest lowest. "temp 1-5" variable has value's in them , wondering there mistake making. <html> <!foundation page building our javascript programs> <head> <title>the foundation page </title> <script language = "javascript"> var name1; var name2; var name3; var name4; var name5; var temp1; var temp2; var temp3; var temp4; var temp5; var ask; function main() { start() totalscore() leaderboard() } function start() { ask = prompt("how many people playing") if (ask == 3) { name1 = prompt("what first player's name?") name2 = prompt("what second player's name?") name3 = prompt("what third player's name?") number = 3 } if (ask == 4) { name1 = prompt("what first player's n...

variables - Informix 4gl Split a String or Char -

i wanted know informix 4gl command split variable such as lv_var = variable01;variable02 into lv_var01 = variable01 lv_var02 = variable02 is there in informix 4gl can this. in python do lv_array = lv_var.split(";") and use variables array there isn't standard function that. 1 major problem returning array. i'd write c function job, in i4gl, like: function nth_split_field(str, c, n) define str varchar(255) define c char(1) define n integer ...code find nth field delimited c in str... end function

excel - MAX date value within a range with 2 conditions -

to make easy +---+----+-------------+ | | | b | +---+----+-------------+ | 1 | xx | 12-05-2015 | | 2 | xx | 15-05-2015 | | 3 | yy | 13-05-2015 | | 4 | yy | 16-05-2015 | +---+----+-------------+ (today 14-05-2015) i need max date value each "a" value if before today. in case it's not, move 2nd biggest value. case not find, empty cell. what i've done far: =max($a$1:$a$4='xx';$b$1:$b$4<today();$b$1:$b$4) and confirm shift + ctrl + enter the error yields 13-05-2015 max value xx, wrong (as if not take account $a$1:$a$4='xx' you need use nested if-functions. i.e. change formula into: {=max(if($a$1:$a$4="xx", if($b$1:$b$4<today(), $b$1:$b$4)))} and end ctrl + shift + enter

scenekit - adding 3d model on SCNView -

i've started build super-puper game :) using scenekit , there 1 thing can't decide. so ... used third party tools create 3d model , export in .dae file, after add .dae file on scnview. for example lets need add 2 3d models on scnview. see there 2 ways add 3d models .dae file on scnview: 1 - create 1 .dae file 2 models in , add 1 scene on scnview 2 - export each 3d model in separate .dae file , add 2 .dae files on scnview i think both ways working want know if there best practices add several 3d models .dae file on scnview. depending on kind of models have, both options. if have lot of categories of models, such characters, environment, props etc., go 1 file each. it's not optimized way it'll save lot of time while creating , editing assets. if work single spritesheet in 2d, such parts of road, collection of buildings, rollercoaster tracks; make single file , query nodes need it. it's more how convinient you, since won't matter after ...

java - Apache Camel runs part of onCompletion and doesn't show stack trace -

i'm trying use camel poll-once route use file if it's present , log error if not. by default route nothing if file not exist i've started adding consumer.sendemptymessagewhenidle=true uri. check null body decide whether log exception or continue: from(thefileuri) .oncompletion() .oncompleteonly() .log("success") .bean(theotheraction, "start") .end() .onexception(exception.class) .logstacktrace(true) .log(error, "failed load file") .handled(true) .end() .choice() .when(body().isnotnull()) .to(next_route_uri) .endchoice() .otherwise() .throwexception(new filenotfoundexception(thefileuri)) .endchoice(); there 2 problems this: if file missing, success log still happens (but not bean!) the stack trace not printed if there better way i'...

android - Estimote SDK for Ecilipse -

i beginner estimote beacons tried convert estimote demo android studio project eclipse ide. i'm getting pretty close, i'm having trouble on library file. following estimote android sdk guide on github @ https://github.com/estimote/android-sdk . i want create demo app estimote notification. logcat error : java.lang.noclassdeffounderror: com.estimote.sdk.estimotesdk this line indicate : estimotesdk.initialize(this, "your app id", "your app token"); note : in first time error in library file in importing aar file error not fixed rename .jar , extracted classes.jar file of link help me wrong. can can acceptable estimote's library project in .aar format. can't directly import , use on eclipse. need make library project extracting contents. for doing so, you'll have following steps: unzip aar directory. create empty directory home android library project. rest of these steps, refer “the output directory”. copy androi...

c# - How do I disable dates in asp .net textbox textmode = date? -

i'm having issue want set disable on dates in textbox textmode = date. prefer done in c#. advice? here aspx page: <asp:textbox id="tbstartdate" runat="server" autopostback="true" ontextchanged="tbstartdate_textchanged" textmode="date"></asp:textbox> and c# file protected void disablepastdateintextbox() { ???????? }

java - How can I get the size of Solr Facet results? -

there multi-value field in schema named xxx. , may more 10,0000 documents in solr, want how many values exist in xxx without duplication. for now, use facet.field=xxx&facet.limit=-1 facet results size. spend lot of time , occur read timeout. what want facet results 'size', don't care contents. by way, use solr 5.0, there other better solution solve requirement? the index maintain list of unique terms, since how inverted index works. very fast compute , return, unlike faceting. if values single terms, way of getting want. there way unique terms, given termscomponent enabled in solrconfig.xml. example: http://localhost:8983/solr/corename/terms?q=*%3a*&wt=json&indent=true&terms=true&terms.fl=xxx would return list of unique terms, , counts: { "responseheader":{ "status":0, "qtime":0}, "terms":{ "xxx":[ "john backus",3, "ada lovelace",3, ...

windows services - Invalid File Handle Opening Directory in Mounted Drive to UNIX -

there 1 windows service trying access mounted drive in unix, fails the mounting command is: mount -o anon -o mtype=soft \\xx.xx.xx.xx\u01\sourcedata h: however, windows service throwing exception: invalid file handle opening directory further investigation, now, perform mount command in cmd, though drive mounted successfully, not accessed correctly. i view contents of files, not open, or copy files. the error pop saying: the remote computer refused network connection. this weird. last time ok. any idea? thanks experts!

dc.js - Dimensional Charting with Non-Exclusive Attributes -

Image
the following schematic, simplified, table, showing http transactions. i'd build dc analysis using dc , of columns don't map crossfilter . in settings of question, http transactions have fields time , host , requestheaders , responseheaders , , numbytes . however, different transactions have different specific http request , response headers. in table above, 0 , 1 represent absence , presence, respectively, of specific header in specific transaction. sub-columns of requestheaders , responseheaders represent unions of headers present in transactions. different http transaction datasets surely generate different sub-columns. for question, row in chart represented in code this: { "time": 0, "host": "a.com", "requestheaders": {"foo": 0, "bar": 1, "baz": 1}, "responseheaders": {"shmip": 0, "shmap": 1, "shmoop": 0}, "numbytes": 12 }...

android - Set initial background color before loading -

how can set background color of activity before setcontentview . have activity takes lot of time load, need keep background white until activity finishes loading. i guess need. first define color in values/colors.xml <resources> <color name="background">#ffffff </color> </resources> create themes.xml file in res/values references color: <resources> <style name="mytheme" parent="@android:style/theme.light"> <item name="android:windowbackground">@color/background</item> </style> </resources> ... , in androidmanifest.xml specify theme activity use. <activity android:name=".myactivity" android:theme="@style/mytheme" />

c - Structured linked list to an array -

typedef struct node { int value; struct node* next; }node; int* to_array (node* ll, int size) { int = 0; int* arr = malloc(size*sizeof(int)); while (ll) { arr[i] = ll->value; ll = ll->next; i++; } return arr; } can please explain why int* arr = malloc(size); will give array? thought when have pointers cannot change individually arr[i] = 5 or something. your question. granted, 1 that's been asked , answered many times on so. question nonetheless. from c/c++ faq: http://c-faq.com/~scs/cgi-bin/faqcat.cgi?sec=aryptr arrays not pointers, though closely related (see question 6.3) , can used (see questions 4.1, 6.8, 6.10, , 6.14). when declare array (e.g. int a[5] ), you've allocated storage 5 "int" elements. can access each element a[i] . when declare pointer (e.g. int *b ) haven't allocated any storage. you can declare , initialize pointer @ same time: int *b = ...

ruby on rails - Puma is not working with nginx in ROR -

i using command manually bundle exec puma -e production -b unix:///var/www/rails_apps/agarcents/shared/tmp/sockets/puma.sock my server working fine. i'm able access url when bind socket nginx, i'm unable access server. my nginx configuration is upstream puma_agarscents { server unix:/var/www/rails_apps/agarcents/shared/tmp/sockets/puma.sock fail_timeout=0; } server { listen 80; server_name x.x.x.x; # change match url root /var/www/rails_apps/agarcents/current/public; listen 443 ssl; location / { proxy_pass http://puma_agarscents; proxy_set_header host $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } ssl_certificate /etc/nginx/ssl/nginx.crt; ssl_certificate_key /etc/nginx/ssl/nginx.key; location ~* ^/assets/ { # per rfc2616 - 1 year maximum expiry expires 1y; add_header cache-control public; # browsers still send conditional-get requests if there's # last-modified header or etag heade...

c++ - Why this code doesn't work when "cout"s are commented? -

i'm writing server online game based on iocp, , core codes handling game message below: cmessage ret; int now_roomnum = recv_msg->para1; int now_playernum = recv_msg->para2; /*if(true) { cout<<"received game message: "<<endl; cout<<"type2 = "<<recv_msg->type2; cout<<" player_num = "<<now_playernum<<" msg= "<<recv_msg->msg<<endl; cout<<endl; }*/ if(recv_msg->type2 == msg_game_operation) { ret.type1 = msg_game; ret.type2 = msg_game_operation; while(game_host[now_roomnum].ready(now_playernum) == true) { ; } //cout<<"entered "<<now_playernum<<endl; game_host[now_roomnum].setmessage(now_playernum, recv_msg->msg); game_host[now_roomnum].setready(now_playernum, true); game_host[now_roomnum].setused(now_playernum, false); while(true) { bool tmp = game_host[now_...

python - generate an artificial data set for context bandit algorithm -

i want generate following artificial dataset test contextual bandit algorithm. easiest way done in python may be? can point me link demonstrates code it? the unit vectors θ1 , ..., θk k actions drawn uniformly rd . in each iteration t of t complete iterations, context xt first sampled uniform distribution within ∥x| ≤ 1. if understand question right, want generate: context xt uniform distribution a unit vector of k elements indicating arm choose single value being set one, again uniform distribution both tasks can achieved numpy package: use numpy.random.uniform generate values uniform distribution within range. use numpy.random.randint generate integers uniform distribution , use generated values set list element 1.

service - Asking about SSRS expression font change -

i have expression this: fields!prodname.value & vbcrl fields!address.value & vbcrlf & fields!city.value + " ," + fields!state.value & vbcrlf & fields!pincode.value & vbcrlf & in above want bold first field, , leave remaining text in normal font. what version of ssrs using? if have 2012, can use html tags in text box placeholder add formatting: "<b>" & fields!prodname.value "</b>" & vbcrl fields!address.value & vbcrlf & fields!city.value + " ," + fields!state.value & vbcrlf & fields!pincode.value & vbcrlf &

java - How to delete rows from sqlite table for a given date range using string value? -

i pass date values fetch matching rows fall between dates (fd=from date , td=to date)and string txid deletion table. unable use 'between' , 'and' clause here 'where' clause. how use these clauses in whereargs correctly fetch rows deletion? public int deleteallexpensestxrowforselectperiod(string fd,string td){ sqlitedatabase db=helper.getwritabledatabase(); string txid="e"; string[] whereargs={txid}; int countdb=db.delete(vivzhelper.tx_table, vivzhelper.tx_id + " =?", whereargs); return countdb; } first think missing space between = , ?. then, can write argument use dates. string[] whereargs={txid, fd, td}; int countdb=db.delete(vivzhelper.tx_table, vivzhelper.tx_id + " = ? , date < ? , date > ?", whereargs);

php - Lazy Load listview Item from server json response -

i'm developing android app load data server json parser.i want load data in 10 item part server , when user scroll down listview new 10 item part load server , add current listview(such market apps). here java code: public class allproductsactivity extends listactivity { //jpcode int part=0; string refreshnumber="0"; //convert shamsi roozh jcal = new roozh(); string myjpdiff; imagebutton btnnewproduct; view ntcheck; private sessionmanager session; private button logout; //internet check jp // flag internet connection status boolean isinternetpresent = false; // connection detector class connectiondetector cd; //end internet check jp private sqlitehandler db; //jpcode //end jpcode // progress dialog private progressdialog pdialog; // creating json parser object jsonparser jparser = new jsonparser(); arraylist<hashmap<string, string>> pr...

jquery - Trying to toggle animate div square (can't figure out error) -

so, i'm using this: http://jsfiddle.net/tjugd/3427/ as basis animate squares in carousel (all have class="carouselbutton": http://jsfiddle.net/ybrx3/1035/ javascript $('.carouselbutton').toggle(function(){ $(this).animate({height:'300',width:'300'}); },function(){ $(this).animate({height:'80',width:'80'}); }); it's not working. i'm wondering if of other class labels interfering. appreciate anyone's input! (side note: can't figure out how vertically align text within squares. when use vertical-align:middle , changes shape of square. i'm not sure if i'm going in trouble tagging second onto this, though.)

javascript - gulp-insert exclude wrap certain files -

i want use gulp-insert wrapping on every js file, except .module.js file. here gulp task: gulp.task('compressjs', function() { gulp.src("local/app/**/*.js") .pipe(sourcemaps.init()) // wrap each individual js file .pipe(insert.wrap('(function(){"use strict";', '\n})();')) .pipe(uglify()) .pipe(concat('all.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('public/app')); } it wrapping every single js file expected. so, how can exclude wrapping file .module.js extension? you try using gulp-add-src excluding .module.js first source piping through gulp-insert , adding .module.js back source. var addsrc = require("gulp-add-src"); gulp.task('compressjs', function() { gulp.src(["local/app/**/*.js", "!local/app/**/*.module.js"]) .pipe(sourcemaps.init()) // wrap each individual js file .pipe(insert.wrap('(fu...

javascript - disabling image map in mobile media screen -

i want disable image map while media screen in mobile screen. i have trying include javascript in head tag of html file, shows error error : <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script> if($(window).width() < 1200){ /*document.getelementbyid("imgmap").removeattribute("usemap");*/ document.getelementbyid("imgmap").setattribute('usemap','disabled'); } if($(window).width() > 1199){ document.getelementbyid("imgmap").setattribute('usemap','#map'); } </script> and image map : <img class="bdg-homeimg" id="imgmap" src="http://www.chiantisculpturepark.it/newdesign/img/pievasciata.jpg" usemap="#map"> <map name="map" id="map"> <area shape="rect" coords="90,100,140,120" title="massimoturato" hr...

which unicode should be used UTF-8 and UTF-16 when deal with accented characters in java response to Ajax -

first of all, main difference between utf-8 , utf-16, and when dealing accented character in ajax java, facing issue is in question [ https://stackoverflow.com/questions/30227083/java-response-to-ajax-with-accented-characters-garbled][1] many if can me this. i suggest reading utf-8 article on wikipedia , it's excellent. >what main difference between utf-8 , utf-16 utf-8 variable width , can handle characters in unicode, first 128 characters of utf-8 latin-1 identical 7-bit ascii , therefore 7-bit ascii proper subset of utf-8 every character 1 byte has advantage old character handling code work seamlessly utf-8 content if know it's never going other latin-1. for handling code pages outside of latin-1 (your accented characters , other languages) utf-8 use more 1 byte per character. utf-16 older standard can handle unicode characters doesn't have backwards compatibility ascii because it's @ least double byte. therefore utf-8 more efficient ut...

jquery - fastest way to group keys with the same numeric value from a javascript object? -

'lets have object var obj = { apples: 2, grapes: 1, oranges:2, carrots:2, potatoes: 4 } how write fast executing function return keys grouped values? return { "2": ['apples', 'oranges', 'carrots'], "4" : ['potatoes'], "1" : ['grapes'] } you can use simple for..in achieve this: var obj = { apples: 2, grapes: 1, oranges:2, carrots:2, potatoes: 4 }; var result = {}; for(var key in obj) { if(!(obj[key] in result)) result[obj[key]] = []; result[obj[key]].push(key); } console.log(result);

mysql - How to add date condition to my query? -

i have sql statement. works, , need add 1 condition. need sort date. occurence - date row. select dd.caption, count(t.occurence) transaction t inner join dict_departments dd on dd.id = t.terminal_id group dd.caption how add condition: where t.occurence between (current_date() - interval 1 month) to query. between requires 2 arguments, start point , end point. if end point current time, have 2 options: using between : where t.occurence between (current_date() - interval 1 month) , now() using simple comparison operator: where t.occurence >= (current_date() - interval 1 month)

java - Trouble with slick.util and lwjgl textures -

so i've started making simple 2-d java game using jlwgl , slick-util. ran problem when trying load in textures place on tiles. using slick util try , load textures in. method using so. public static texture loadtex(string path, string filetype) { texture tex = null; inputstream in = resourceloader.getresourceasstream(path); try { tex = textureloader.gettexture(filetype, in); } catch (ioexception e) { e.printstacktrace(); } return tex; } i set variable "t" store variable check if texture loading works. texture t = loadtex("res/grass64.png","png"); i use glquads method draw textured square. public static void drawquadtex(texture tex, float x, float y, float width, float height) { tex.bind(); gltranslatef(x, y, 0); glbegin(gl_quads); gltexcoord2f(0, 0); glvertex2f(0, 0); gltexcoord2f(1, 0); glvertex2f(width, 0); gltexcoord2f(1, 1); glvertex2f(width, h...

html - Use one javascript script to dynamically modify another script -

yo! i have arbitrary javascript file, let's call localscript , , looks this: <script id="myscript" type="text/javascript"> function () { var blue = 'blue'; var person = { firstname:"john", lastname:"doe", age:50, eyecolor:"brown" }; var blueperson = function () { person[color] = blue; }; } </script> i want able use externalscript dynamically change contents of localscript . simple example, let's want update of values in localscript , like—maybe change age of person object 75. (obviously, there's simple ways this, use case it's imperative use externalscript generate contents of localscript ). it easy if there .innerhtml use in externalscript allow me select element , replace 'innerhtml' contents. localscript , though, isn't composed of elements. as far know, when using...

shell scripting do loop -

sorry im new unix, wondering there anyway can make following code loop. example file name change every time 1 50 my script is cut -d ' ' -f5- cd1_abcd_w.txt > cd1_rightformat.txt ; sed 's! \([^ ]\+\)\( \|$\)!\1 !g' cd1_rightformat.txt ; sed -i 's/ //g' cd1_rightformat.txt; cut -d ' ' -f1-4 cd1_abcd_w.txt > cd1_extrainfo.txt ; i make loop cd1_abcd_w.txt become cd2_abcd_w.txt , output cd2_rightformat.txt etc...all way 50. cd$i. many thanks in bash , can use brace expansion: for num in {1..10}; echo ${num} done similar basic for = 1 10 loop, it's inclusive @ both ends, loop output numbers 1 through 10. you replace echo command whatever need do, such as: cut -d ' ' -f5- cd${num}_abcd_w.txt >cd${num}_rightformat.txt # , on if need numbers less ten have leading zero, change expression in for loop {01..50} instead. doesn't appear case here it's handy know. also in not-needed-but-handy-t...

node.js - express res.redirect target page js not loaded -

i using node.js + express + jade demo simple pages. got problem 2 days. googled lot, cannot find answer. basically, redirect page another. , on target page, have socket.io code inside document.ready. problem /pageone, pagetwo rendered correctly(but url in browser still /pageone), code inside document.ready not executed. my router.js app.post('/pageone', session, function(req, res){ res.redirect('/pagetwo'); }); app.get('/pagetwo', function(req, res){ res.render('pagetwo', { title: 'demo' }); }); my pagetwo jade doctype html head title #{title} - site link(rel='stylesheet', href='/css/style.css') script(type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js') script(type='text/javascript' src='https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js') script. $(document).ready(function() { alert(...

javascript - Browserify and Reactify source maps include full local path names -

Image
i use watchify/ browserify create bundle debug source maps command- watchify main.js -o bundle.js -v -d when use chrome devtools debug resulting app, source files accessible in orginal nested folder locations, visible in devtools' sources panel. however when run through reactify command- watchify main.js -t reactify -o bundle.js -v -d chrome devtools shows source files in same folder bundle.js , file name includes full local path name. i finding annoying , hard identify correct file both in sources panel , in individual tabs file long display. does know how around source files display in original folder locations (as per pic 1). thx you need specify --full-paths option browserify false see: https://github.com/substack/node-browserify#usage watchify main.js -t reactify -o bundle.js -v -d --full-paths=false

c++ - How to reverse iterate vector with iterator? -

for example: for(int i=0;i<v.size();i++){ } is normal order, for(int i=v.size()-1;i>=0;i--){ } is reversed order, how reverse version of iterator? for(vector<int>::iterator it=v.begin();it!=v.end();++it){ } also there reverse version of code style? for(int : v){ } use reverse iterator : for(auto = v.rbegin(); != v.rend(); ++it){/*...*/} there no built in way range based for in reverse, use boost::adaptors::reversed : for(auto& : boost::adaptors::reversde(v)){/*...*/}

Typescript Generics - Extending a class -

as example, have following class: module app.components.base { export class basecontroller<s extends iappscope, a> { public data:string; constructor(public $scope: s, public service: a, public $state: ng.ui.istateservice, public $ionichistory) { console.log('base controller loaded!'); console.log($scope); $scope.vm = this; } } } then have separate class: module app.components.properties { export class propertiescontroller extends base.basecontroller<ipropertiesscope, app.services.propertyservice> { } } so, in mind, says "the properties controller extends base controller. properties controller therefore should have this.$scope , , this.$scope should of type ipropertiesscope since generic type s inherits ipropertiesscope interface`." however, $scope undefined in constructor of base class. why value undefined? $scope undefined in constructor of base c...

Spinner with Icon and Text like Phone App on Android (with Bluetooth) -

Image
i want re-create following: specifically, note bluetooth icon, clicking on brings looks spinner? or dialog somehow located correctly? couldn't find phone app code anywhere, , @ loss how best implement this. i figured out solution shortly after posting question. the correct solution use popupwindow . here pretty need do: layoutinflater layoutinflater = (layoutinflater)getbasecontext() .getsystemservice(layout_inflater_service); view popupview = layoutinflater.inflate(r.layout.bluetooth_popup, null); popupview.findviewbyid(r.id.bluetooth).setonclicklistener(this); popupview.findviewbyid(r.id.speakerphone).setonclicklistener(this); popupview.findviewbyid(r.id.earpiece).setonclicklistener(this); popupwindow = new popupwindow( popupview, viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content); // these 2 allow popupwindow dismissed when touch occurs outside ...

c - STM32 STM32CubeF4 USB CDC operation -

i built code stm32cubef4 usb cdc example. added missing receive code cdc_receive_fs() in usbd_cdc_if.c. loaded stm32f4 discovery , works. character typed on tera term returns , displayed on tera term. i hoping here, give me knowledge how usb cdc firmware works, specifically, being driven interrupt generated when there level shift in voltage on usb -d , +d pins, or there infinite while loop launched somewhere, , it's polling waiting data appear? prompted question see 1 can blink leds on board toggling state of gpio pins within infinite while loop in main.c. however, there nothing within while loop @ within main.c usb. how usb cdc firmware , send character from/to tera term. i take 2 minutes answer instead of lecturing you. receive done through interrupts. very, simply, hardware sees voltage change on d+/d- , flags interrupt based on intialization functions. interrupt calls hal_pcd_irqhandler, calls usbd_ll_datainstage in usbd_conf.c file. ends calling function usbd_cd...

python 3.x - Test post requests on django, csrf_token -

i trying test of post methods in django app, due csrf_token , can not test without browser. used @csrf_exempt decorator forget remove decorators in production. there better way this? @csrf_exempt(in_debug_only=true) so decorator active when application in debug mode. or there better way test post requests? like selenium might have methods that? note: m using django 1.7.2 , python 3.4.1 inspired this answer : you can add new file app, let's call disable_csrf.py : class disablecsrf(object): def process_request(self, request): setattr(request, '_dont_enforce_csrf_checks', true) then can edit settings.py add this: if debug: middleware_classes += myapp.disable.disablecsrf let me know if worked.

javascript - Angular js directive doesn't work on page load -

i new angularjs below directive support decimal , commas, works fine when change made field how ever data in fields not validated when page loads var app = angular.module('myapply.directives', [], function () { }); app.directive('numericdecimalinput', function($filter, $browser, $locale,$rootscope) { return { require: 'ngmodel', priority: 1, link: function($scope, $element, $attrs, ngmodelctrl) { var replaceregex = new regexp($locale.number_formats.group_sep, 'g'); var fraction = $attrs.fraction || 0; var listener = function() { var value = $element.val().replace(replaceregex, ''); $element.val($filter('number')(value, fraction)); }; var validator=function(viewvalue) { ngmodelctrl.$setvalidity('...