Posts

go - Using new and assigning variable at the same time -

wd := new(time.weekday) fmt.println(wd.string()) the above 2 lines return sunday (weekdays start 0) is possible me assign value along new ? other method tried var wd time.weekday wd = 3 this 1 returns wednesday time.weekday int can assign such (or use defined constants adam suggested). can ask why need use new in situation? package main import ( "fmt" "time" ) func main() { var wd time.weekday = 3 fmt.println(wd) }

asp.net mvc 4 - itextsharp advance pdf generation by configuration xml -

i generating pdf using itextsharp.i got many sample code in google how can configure pdf setting required generate pdf like var doc = new document(pagesize.a5); var doc = new document(new rectangle(100f, 300f)); these setting wanted set config xml file , read xml , generate pdf on fly. professional sample example code available?plz help..

java - Prevent RecyclerView showing previous content when scrolling -

i have recyclerview gridlinearlayout , custom adapter. content of each item picture downloaded using json , parsing it. basically grid of pictures. everything works fine, however, when scrolling down content, , going again, shows previous views in each item less second, , show proper picture again. what prevent or fix this? in advance and/or guidance provide. this adapter code: package jahirfiquitiva.project.adapters; import android.content.context; import android.graphics.bitmap; import android.support.v7.graphics.palette; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.view.animation.animation; import android.view.animation.animationutils; import android.widget.imageview; import android.widget.linearlayout; import android.widget.progressbar; import android.widget.textview; import jahirfiquitiva.project.activities.wallpapersactivity; import com.koushikdutta.async....

javascript - How can I keep this table header fixed? -

i'd keep table header fixed, problem when set thead position fixed loses size. basically, want keep thead moving rest of table original shape , size . thanks in advance. table { margin: 100 0 100 0; width: 100%; } th, td, table { /*word-wrap: break-word;*/ border: 1px solid black; border-radius: 3px; } body { overflow: hidden; } .scrollable { height: 100%; display: flex; flex-direction: column; overflow-y: scroll; } thead { position: fixed; width: 100%; } .myhead { width: auto; border: 11px solid blue; } <!doctype html> <html> <head> <title>mytable</title> </head> <body> <div class="scrollable"> <table> <thead> <tr class="myhead"> <th class="header" align="center">title</th> <th class="header" align="center">t...

angularjs - The correct definition of data -

i have code, when run error of "referenceerror: data not defined" have defined data in several ways nothing seem correct. thing when think data declared in api (no?).. appreciate help.. app.service('statisticsservice', ['apiclient', '$q', '$rootscope', '$timeout', function (apiclient, $q, $rootscope, $timeout) { var self = this; self.getstatisticsfromserver = function (data) { var deferred = $q.defer(); //1 apiclient.getstatstopmeeters(data) .then(function (response) { //2 console.log('externalapiconnect', response); if (response.data.length === 0 || response.result !== "success") { // todo: show error deferred.reject(response); ...

regex - Regular Expression substring start and end with JavaScript -

i have string: "/upload/c_fill,w_960,h_640/v1430399111/" where want replace wherever "w_" other value, w_960 w_930 while 960 vary. i tried following not able find string end with: var imgpath = elempath.replace(/(\,w_)/, ",w_"+930); if understand correctly wanted replace ,w_ followed 3 digits ,w_930 . on right track. can use \d match digit , {3} 3 repetitions. don't need group () or escape comma: var imgpath = elempath.replace(/,w_\d{3}/, ",w_"+930); if number of digits can vary, use + (one or more repetitions): var imgpath = elempath.replace(/,w_\d+/, ",w_"+930);

Passing context to qweb report for managing table visibility - odoo -

how can pass context value qweb report can control visibility of tables. have qweb report lot of tables. depending on selection list, want control view of these tables in qweb report. option control using context. didn't find way pass context. if there other opinion, please share. create parser class first import time openerp.osv import osv openerp.report import report_sxw class sale_quotation_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(sale_quotation_report, self).__init__(cr, uid, name, context=context) self.localcontext.update({ ‘key’: value, ‘function_name’: self.function_name, }) def function_name(self): ### add code if required.. then define class class report_saleorderqweb(osv.abstractmodel): _name = ‘module_name.report_sale_order_qweb’ _inherit = ‘report.abstract_report’ _template = ‘module_name.report_sale_order_qweb...