Saturday 15 June 2013

css - Centering menu nav-bar items in center of newvar twitter bootstrap -



css - Centering menu nav-bar items in center of newvar twitter bootstrap -

this have. how center these 3 navbar items center of page without messing in mobile view? thanks.

any css tricks?

<div class ="container" id = "main"> <div class="navbar navbar-fixed-top"> <div class="container"> <!-- .btn-navbar used toggle collapsed navbar content --> <button class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="nav-collapse collapse navbar-responsive-collapse"> <ul class="nav navbar-nav"> <li class="active"> <a href="#"> </a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">services <strong class="caret"></strong></a> <li> <ul class="nav navbar-nav"> <li class="active"> <a href="#"> contact </a> </li> </div><!-- end nav-collapse --> </div><!-- end container --> </div><!-- end navbar -->

css twitter-bootstrap

security - Hide groovy stack trace in xwiki macros -



security - Hide groovy stack trace in xwiki macros -

i'm developing groovy macro in xwiki, , @ nowadays stack trace generated when macro fails invaluable debugging. seem security hole when others utilize it. there way turn stack traces off, perhaps users without programming rights?

first if security hole mean user can see groovy code user have view right on document can view code technically anyway hiding stack trace not going completly hide it.

now reply question, error not configurable way can think of patch either script macro (https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-script/src/main/java/org/xwiki/rendering/macro/script/abstractscriptmacro.java#l286) or more generic macroerrormanager (https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-transformations/xwiki-rendering-transformation-macro/src/main/java/org/xwiki/rendering/internal/transformation/macro/macroerrormanager.java).

security groovy xwiki

excel - Payweek calculation ending each Sunday -



excel - Payweek calculation ending each Sunday -

i using next formula find week ends of sunday.

=ceiling.math(a5,7)+1

i had add together "+1" because getting saturday. problem happens on final sunday should have same pay week instead iterates next sunday.

12 oct resulting in 19 oct payweek. should end payweek.

formula:

=a5+(7-weekday(a5,2))

this formula convert date date of next sunday sunday returning spanning years , months.

excel

javascript - Link button with video time -



javascript - Link button with video time -

i'm trying show button when user reaches @ time of video, button appear when user has seen 20 minutes of video. have no thought it, appreciate inputs. thanks

well if video playing through html5 (a video tag) not embedded next code 1 route take.

// video element var video = document.getelementsbytagname('video')[0]; // add together event listener 'timeupdate' video.addeventlistener('timeupdate', function() { // 20 mins in seconds if ( this.currenttime == 1200) { // code add together button here... } }, false);

you should check out html5 audio/video api

javascript video video-streaming html5-video

c# - Possible to check if Key V is pressed in AddingNewItem event in WPF Datagrid -



c# - Possible to check if Key V is pressed in AddingNewItem event in WPF Datagrid -

is possible check if key v pressed in addingnewitem event in wpf datagrid similar how done in previewkeydown event

private void grd_previewkeydown(object sender, keyeventargs e) { if (e.key == key.v && (keyboard.modifiers & modifierkeys.control) == modifierkeys.control) { //todo } }

i checking if ctrl+v pressed, possible same check in addingnewitem event?

you can utilize keyboard.iskeydown() this:

if (((keyboard.iskeydown(key.leftctrl) || keyboard.iskeydown(key.rightctrl)) && keyboard.iskeydown(key.v))) { // ctrl + v pressed }

c# wpf xaml datagrid

What is the "m=" attribute in a html tag? (Plus tons of other attributes found in bing result source) -



What is the "m=" attribute in a html <a> tag? (Plus tons of other attributes found in bing result source) -

so looking through source bing images search result, , seems html each hyperlink each returned image similar to:

<a href="#" ihk="hn.607992005913609849" m="{ns:&quot;images&quot;,k:&quot;5064&quot;,mid:&quot;3d11808868db7b3bd88719756eece65700723f87&quot;,surl:&quot;http://www.absoluteanime.com/naruto/kakashi.htm&quot;,imgurl:&quot;http://www.absoluteanime.com/naruto/kakashi.jpg&quot;,oh:&quot;225&quot;,tft:&quot;43&quot;,dls:&quot;images,5431&quot;,oi:&quot;http://www.absoluteanime.com/naruto/kakashi.jpg&quot;}" mid="3d11808868db7b3bd88719756eece65700723f87" onclick="return false;" t1="kakashi hatake" t2="640 x 480 · 32 kb · jpeg" t3="www.absoluteanime.com/naruto/kakashi.htm" h="id=images,5064.1" >

now, looking @ w3schools documentation <a> tag here, there doesn't seem documentation of these attributes, , after decently extensive googling , irc lurking can't find info on them.

am misunderstanding these things, i.e not attributes? (i relatively new html) or there somehow ton more attributes out there commonly documented?

i interested in m attribute because seems part of the <a> tag contains url of original image (as opposed bing's thumbnail).

in short, these custom attributes.

html tags allow set custom attributes on them , browsers ignore ones not understand.

some sample usages of feature in current utilize are:

to store meta-data libraries angularjs utilize them create directives

html

jquery - Add onClick to an input being built by JavaScript -



jquery - Add onClick to an input being built by JavaScript -

i have file type input button needing clear if user chooses , safe solution have found destroy input , rebuild it. have right works "harp gun" solution in works once.

basically, user has file input so:

<input type="file" name="filestoupload" id="filestoupload" onchange="makefilelist();" /> <ul id="filelist"><li>no files selected</li></ul>

and when select file, may need clear completely.

so have beingness built via appending on filelist:

function makefilelist() { var input = document.getelementbyid("filestoupload"); var ul = document.getelementbyid("filelist"); while (ul.haschildnodes()) { ul.removechild(ul.firstchild); } (var = 0; < input.files.length; i++) { var li = document.createelement("li"); var filesize = input.files[i].size; li.innerhtml = input.files[i].name +"&nbsp;"+ "<span id=\"lblsize\"></span><input onclick=\"clearfileinput()\" type=\"button\" value=\"clear\" \/>"; ul.appendchild(li); } if(!ul.haschildnodes()) { var li = document.createelement("li"); li.innerhtml = 'no files selected'; ul.appendchild(li); } };

and destroy file, function rebuilds input so:

function clearfileinput(){ var oldinput = document.getelementbyid("filestoupload"); var newinput = document.createelement("input"); newinput.type = "file"; newinput.id = oldinput.id; newinput.name = oldinput.name; newinput.classname = oldinput.classname; newinput.style.csstext = oldinput.style.csstext; // re-create other relevant attributes oldinput.parentnode.replacechild(newinput, oldinput); };

so can create element, add together file type, , utilize old input id, class , name. need have same onchange="makefilelist(); behavior well.

here fiddle. help appreciated.

simply add together attribute.

function clearfileinput(){ var oldinput = document.getelementbyid("filestoupload"); var newinput = document.createelement("input"); newinput.type = "file"; newinput.id = oldinput.id; newinput.name = oldinput.name; newinput.classname = oldinput.classname; newinput.style.csstext = oldinput.style.csstext; newinput.setattribute("onclick", "makefilelist()"); // re-create other relevant attributes oldinput.parentnode.replacechild(newinput, oldinput); };

javascript jquery file-io

javascript - Duplicate array -



javascript - Duplicate array -

i need duplicate , manipulate array variable, reason when force value newly created array pushing value original array.

function testing (point) { var newarray = currentchain; newarray.push(point); }

in situation, point beingness added currentchain variable. note setting currentchain equal newarray , there no other variables in script called newarray. why behaving way?

to prepare need clone array. illustration using slice method:

var newarray = currentchain.slice();

this happens because newarray pointer currentchain array.

javascript arrays variables duplicates

node.js - PUT and DELETE always route to GET in Node + Express -



node.js - PUT and DELETE always route to GET in Node + Express -

i'm beginner in node/express. tried create crud application stuck @ update , delete. think router code problematic don't know why. next code in controller, works put , delete. route get. tried utilize next(); returns error: can't set headers after sent..

i can create delete works using get /:company_id/delete it's not , standardized solution. how can update , delete process worked?

'use strict'; var companies = require('../../models/companies'); module.exports = function (router) { // index // accessed @ http://localhost:8000/companies router.get('/', function (req, res) { companies.find(function(err, model) { if (err) { res.send(err); } else { res.format({ json: function () { res.json(model); }, html: function () { res.render('companies/index', model); } }); } }); }); // create view // accessed @ http://localhost:8000/companies/create router.get('/create', function (req, res) { res.render('companies/create'); }); // create info // accessed @ post http://localhost:8000/companies router.post('/', function (req, res) { var name = req.body.name && req.body.name.trim(); var type = req.body.type && req.body.type.trim(); // validation if (name === '') { res.redirect('/companies/create'); return; } var model = new companies({name: name, type: type}); model.save(function(err) { if (err) { res.send(err); } else { res.redirect('/companies'); } }); }); // read // accessed @ http://localhost:8000/companies/:company_id router.get('/:company_id', function(req, res) { companies.findbyid(req.params.company_id, function(err, model) { if (err) { res.send(err); } else { res.render('companies/read', model); } }); }); // update view // accessed @ http://localhost:8000/companies/:company_id/edit router.get('/:company_id/edit', function(req, res) { companies.findbyid(req.params.company_id, function(err, model) { if (err) { res.send(err); } else { res.render('companies/edit', model); } }); }); // update info // accessed @ set http://localhost:8000/companies/:company_id router.put('/:company_id', function(req, res) { companies.findbyid(req.params.company_id, function(err, model) { if (err) { res.send(err); } else { model.name = req.body.name; model.type = req.body.type; model.save(function(err) { if (err) { res.send(err); } else { res.redirect('/companies'); } }); } }); }); // delete // accessed @ delete http://localhost:8000/companies/:company_id router.delete('/:company_id', function (req, res) { companies.remove({ _id: req.params.company_id }, function(err) { if (err) { res.send(err); } else { res.redirect('/companies'); } }); }); };

html forms back upwards get , post. xmlhttprequest supports put , delete however, may have go route or utilize method-override allow html forms submit using other http verbs.

node.js express

web services - Send base64 string as image to the client -



web services - Send base64 string as image to the client -

i managed save image base64 encoded string in database, wondering how tu serve base64 string in way interpreted image on client side.

i made ws returns string :

return ok(mybase64string).as("image/jpeg")

but image cannot displayed in browser.

if decode string , send byte array image displayed, dont understand why have decode encoded image in order display in client??

byte [] test = base64.decodebase64(event.getphoto()); homecoming ok(test).as("image/jpeg");

this works why have decode base of operations 64 string??

anyone have idea? thanks!!

if want utilize base64, need utilize data uri scheme:

<img src="data:image/png;<base64>" />

otherwise have pass in path binary representation. that's assets controller does, serving file binary.

image web-services rest playframework playframework-2.0

sql - Select unique barcode with max timestamp -



sql - Select unique barcode with max timestamp -

i'm trying write sql query using microsoft sql server.

my table looks similar this:

bardcode | products | timestamp 1234 | 12 | 2013-02-19 00:01:00 1234 | 17 | 2013-02-19 00:01:00 432 | 10 | 2013-02-19 00:01:00 432 | 3 | 2013-02-19 00:02:00 643 | 32 | 2013-02-19 00:03:00 643 | 3 | 2013-02-19 00:03:00 123 | 10 | 2013-02-19 00:04:00

i'm trying list of unique barcodes based on recent timestamps.

here not-working query i've been thinking of:

select distinct [barcode], [timestamp] [inventorylocatordb].[dbo].[inventory] max([timestamp])

edit i'd retain additional columns well. do bring together or someting.

for illustration want select the barcode latest timestamp , of other column info come e.g. products column

this should work:

select [barcode], max([timestamp]) [inventorylocatordb].[dbo].[inventory] grouping [barcode]

demo

edit

select [barcode], [products], [timestamp] [inventorylocatordb].[dbo].[inventory] [timestamp] = (select max([timestamp]) [inventorylocatordb].[dbo].[inventory] [barcode] = i.[barcode])

the query retains tuples same barcode / timestamp. depending on granularity of timestamp may not valid.

demo 2

there many ways "filter" above result.

e.g. 1 tuple per barcode, latest timestamp, greatest value of products:

select [barcode], [products], [timestamp] [inventorylocatordb].[dbo].[inventory] [timestamp] = (select max([timestamp]) [inventorylocatordb].[dbo].[inventory] [barcode] = i.[barcode]) , [products] = (select max([products]) [inventorylocatordb].[dbo].[inventory] [barcode] = i.[barcode] , [timestamp] = i.[timestamp])

demo 3

sql sql-server

extjs - Ext JS Grid Panel Height Property -



extjs - Ext JS Grid Panel Height Property -

i'm creating grid using ext js. need increment height of grid panel automatically increment of number of rows in grid. property of ext js grid can set implement this?

just don't specify value height property, , that's all.

try here: https://fiddle.sencha.com/#fiddle/bnl

ext.create('ext.data.store', { storeid:'simpsonsstore', fields:['name', 'email', 'phone'], data:{'items':[ { 'name': 'lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" }, { 'name': 'bart', "email":"bart@simpsons.com", "phone":"555-222-1234" }, { 'name': 'homer', "email":"home@simpsons.com", "phone":"555-222-1244" }, { 'name': 'marge', "email":"marge@simpsons.com", "phone":"555-222-1254" } ]}, proxy: { type: 'memory', reader: { type: 'json', root: 'items' } } }); // don't specify height when creating grid ext.create('ext.grid.panel', { title: 'simpsons', store: ext.data.storemanager.lookup('simpsonsstore'), columns: [ { text: 'name', dataindex: 'name' }, { text: 'email', dataindex: 'email', flex: 1 }, { text: 'phone', dataindex: 'phone' } ], width: 400, renderto: ext.getbody() });

extjs grid

plsql - Oracle PL/SQL get the first letter from the name(HUN) -



plsql - Oracle PL/SQL get the first letter from the name(HUN) -

the question sounds easy because need substring (name,1,1). in hungarian language there many letter wich contains multicharacter. eg : cs,dz,dzs,ly,ny,sz,ty,zs

if v_type='by_name' select distinct name v_result my_table instr(_start_letters_,substr(upper(v_name),1,1))>0 , zipcode = v_act_zipcode; homecoming v_result;

and table eg:

zipcode name _start_letters 1234 ryan a,b,c 1234 bryan cs,d

and if want name csanád need cs not first char c-> becuase multirow exception.

do have anysuggestion utilize first lettor? or have write huge if-else/case construction create code awful , impenetrable.

thanks

i think straight-forward solution write stored function extracts first letter:

create function hun_first_letter(name in varchar2) homecoming varchar2 begin if substr(upper(name),1,3) in ('dzs') homecoming substr(name,1,3); elsif substr(upper(name),1,2) in ('cs','dz','ly','ny','sz','ty','zs','gy') homecoming substr(name,1,2); else homecoming substr(name,1,1); end if; end;

oracle plsql alphabet

Docker client communicating with docker host -



Docker client communicating with docker host -

i have docker daemon installed in ubuntua machine.

i using ubuntub machine docker client. know ubuntua machine has docker daemon installed , can operations well.

but not getting on port running. using command : sudo docker -h tcp://127.0.0.1:5555 -d &

and after , when utilize next command: sudo docker -h tcp://127.0.0.1:5555 info

i getting error : docker daemon not found . how find out on port , daemon running?

using -h tcp://127.0.0.1:5555 docker daemon alternative on ubuntua machine instruct docker bind loopback network interface (127.0.0.1). result take connections originating ubuntua machine.

if want take connections incoming network interface utilize -h tcp://0.0.0.0:5555. aware able connect ubuntua machine on port 5555 able command docker host. need protect firewall rules allow ubuntub connect ubuntua on port 5555.

docker

angularjs - Extending a controller function within directive -



angularjs - Extending a controller function within directive -

i have cancel function in controller want pass or bind directive. function clears form. this:

app.controller('myctrl', ['$scope', function($scope){ var self = this; self.cancel = function(){... $scope.formname.$setpristine(); }; }]); app.directive('customdirective', function() { homecoming { restrict: 'e' scope: { cancel : '&oncancel' }, templateurl: 'form.html' }; });

form.html

<div> <form name="formname"> </form> </div>

however, $setpristine() don't work controller don't have access on form dom. possible extend functionality of controller's cancel within directive add together $setpristine()?

some suggested using jquery select form dom, (if it's way) how exactly? there more angular way of doing this?

since <form> within directive, controller should have nil it. knowing break encapsulation, i.e. leak implementation details directive controller.

a possible solution pass empty "holder" object directive , allow directive fill callback functions. i.e.:

app.controller('myctrl', ['$scope', function($scope) { var self = this; $scope.callbacks = {}; self.cancel = function() { if( angular.isfunction($scope.callbacks.cancel) ) { $scope.callbacks.cancel(); } }; }); app.directive('customdirective', function() { homecoming { restrict: 'e' scope: { callbacks: '=' }, templateurl: 'form.html', link: function(scope) { scope.callbacks.cancel = function() { scope.formname.$setpristine(); }; scope.$on('$destroy', function() { delete scope.callbacks.cancel; }); } }; });

use as:

<custom-directive callbacks="callbacks"></custom-directive>

i'm not sure ok either though...

angularjs

elasticsearch - Combining Elastic Search Queries -



elasticsearch - Combining Elastic Search Queries -

i using elasticsearch , combine 2 sets of query results 1 query if possible.

i using 3 fields this.

first query want 5 results have field "featured" value "1" fuzzy match term "seo" in fields "title" , "description".

then want remainder of results fuzzy match term "seo" in fields "title" , "description" featured "0".

i unsure if limit 5 can used. ideas anyone. if need more info please allow me know.

thanks in advance.

consider merging 2 queries 1 bool query "should" clause.

elasticsearch match fuzzy-search

.net - How can i change the startup page at WP 8.1 Silverlight -



.net - How can i change the startup page at WP 8.1 Silverlight -

i working on windows phone 8.1 silverlight project, have page want start page not "mainpage.xaml" when go app.xaml.cs can't find responsible code allow me alter startup page, can 1 help me in this

thanks

you can alter manifest file. in solution explorer > properties > wmappmanifest.xml

.net windows-phone-8 windows-phone windows-phone-8.1

sql - Mysql: obtaining n elements of a given subset of N records -



sql - Mysql: obtaining n elements of a given subset of N records -

my goal n "best" items given subset of n registers of table. have table called recipes, , want 5 best recipes (the liked) of last, let's say, 50 recipes uploaded. clarifying, this:

select * `recipes` id in (select id `recipes` order created desc limit 50) order likes desc limit 5

but limit can't used in subquery. so, what's simplest way accomplish that? in advance.

you can same join

select * `recipes` r1 bring together (select id `recipes` order created desc limit 50) r2 on r1.id =r2.id order r1.likes desc limit 5

mysql sql database

android - why the right button can't on the right of parent like left button on the left of parent -



android - why the right button can't on the right of parent like left button on the left of parent -

<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:text="left" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="center" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" android:text="right" /> </linearlayout>

i know can utilize relativelayout , set alignparentright=true,to allow right button on right of parent,but want know,if utilize linearlayout,how can create right button on right of it's parent? help thanks

if have 3 or 2 kid can utilize framelayout instead of linearlayout. if want utilize linearlayout this

<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="left" /> <button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="center" /> <button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="right" /> </linearlayout>

using framelayout parent

<framelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:text="left" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="center" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right|center_vertical" android:text="right" /> </framelayout>

why layout_gravity="right" not working horizontal linearlayout explained here

for horizontal linear layout next values create sense:

top center bottom

that because children of horizontal linear layout layed out horizontally 1 after other. thing can controlled using android:layout_gravity how kid view positioned vertically.

for vertical linear layout next values create sense:

left center right

that because children of vertical linear layout layed out vertically 1 below other. thing can controlled using android:layout_gravity how kid view positioned horizontally.

android layout-gravity

python - Check existence of column names -



python - Check existence of column names -

i have info frame df contains many field names series of years.

field year description 1993 bar0 a01arb92 bar1 a01svb92 bar2 a01fam92 bar3 a08 bar4 a01bea93

then, every year, have stata file has id column , additional columns, (or all) of field names mentioned in df. example, 1993.dta

id a01arb92 a01svb92 a08 a01bea93 0 1 1 1 1 0 1 1 1 2

i need check every year if fields listed in df exist (as columns) in corresponding file. save result in original info frame. there nice way without iterating on every single field?

expected output:

field exists year description 1993 bar0 a01arb92 1 bar1 a01svb92 1 bar2 a01fam92 0 bar3 a08 1 bar4 a01bea93 1

for example, if every field a01fam92 exists in 1993 file column.

here way utilizing fact pandas automatically fill nan missing indices.

first prepare data. may have done step.

df1 = pd.read_csv(r'c:\temp\test1.txt', sep=' ') df1 out[30]: year description field 0 1993 bar0 a01arb92 1 1993 bar1 a01svb92 2 1993 bar2 a01fam92 3 1993 bar3 a08 4 1993 bar4 a01bea93 df1 = df1.set_index(['year', 'description', 'field']) df2 = pd.read_csv(r'c:\temp\test2.txt', sep=' ') df2 out[33]: year description field 0 1993 bar0 a01arb92 1 1993 bar1 a01svb92 2 1993 bar3 a08 3 1993 bar4 a01bea93 df2 = df2.set_index(['year', 'description', 'field'])

next, create new columns in df2 , utilize pandas re-create on columns previous dataframe. fill nan missing values. utilize fillna assign value of 0.

df2['exists'] = 1 df1['exists'] = df2['exists'] df1 out[37]: exists year description field 1993 bar0 a01arb92 1 bar1 a01svb92 1 bar2 a01fam92 nan bar3 a08 1 bar4 a01bea93 1 df1.fillna(0) out[38]: exists year description field 1993 bar0 a01arb92 1 bar1 a01svb92 1 bar2 a01fam92 0 bar3 a08 1 bar4 a01bea93 1

python pandas

django - Looping over two lists in a template -



django - Looping over two lists in a template -

in django template, want access elements in 1 list, whilst looping on elements in list. so, pass lists mylist1 , mylist2 (both have same number of elements) template context variables, , want loop through mylist1, display element, , display corresponding element of mylist2. this:

{% result in mylist1 %} <p>result</p> <p>{{ mylist2.forloop.counter }}</p> {% endfor %}

what's right solution?

django

How to parse the attached JSON in Javascript -



How to parse the attached JSON in Javascript -

the next valid. how access info using json.parse.

[ { "node_title": "mgp", "nid": "4", "album": "myalbum1", "artist": "myartist" }, { "node_title": "pw", "nid": "3", "album": "myalbum1", "artist": "myartist" } ]

use

var jsonstring= '[ {"node_title": "mgp", "nid": "4", "album": "myalbum1", "artist": "myartist"}, {"node_title": "pw", "nid": "3", "album": "myalbum1", "artist": "myartist"} ]' var jsonformatvariable = jquery.parsejson(jsonstring); // in jquery library parse; var jsonformatvariable = json.parse(jsonstring); // in native js parse; console.log(jsonformatvariable );

javascript json

javascript - jquery mobile options in selectBox are not rendered properly -



javascript - jquery mobile options in selectBox are not rendered properly -

hi options in jquerymobile select not rendering properly. below jsfiddle

here's [a link](http://jsfiddle.net/djswv/14/)!

you can see option:2012 not rendered in chrome. height few times width creating problems.

please help me resolve issue.

add next style in css.

#select-choice-year{font-size:15px;}

fiddle demo

javascript jquery css jquery-mobile jquery-plugins

python - How to control individual matplotlib subplots' x-axis scale in real time using tkinter? -



python - How to control individual matplotlib subplots' x-axis scale in real time using tkinter? -

first time posting stackoverflow i'll seek right...

i'm running info acquisition module in python who's input info stream output of different python module. tkinter sliders used control: scale of x-axis of plot (which plotting incoming data), , 'generation speed':

for axisnum in range( len( subplots ) ): wscale = tkinter.scale( master = roots[root], label = "view width on plot %s:" % ( axisnum ), from_ = 3, = 1000, orient = tkinter.horizontal, sliderlength = 30, length = subplots[axisnum].get_frame().get_window_extent().width, ) wscale2 = tkinter.scale( master = roots[root], label = "generation speed plot %s:" % ( axisnum ), from_ = 1, = 200, orient = tkinter.horizontal, sliderlength = 30, length = subplots[axisnum].get_frame().get_window_extent().width ) wscale2.pack( side = tkinter.bottom ) wscale.pack( side = tkinter.bottom ) wscale.set( 100 ) wscale2.set( wscale2['to'] - 3 )

the problem that, though creates 'n' pairs of slider widgets on canvas first active , acts 'master slider' controlling 'n' subplots simultaneously.

slight modifications have led 'x , y info must same length' beingness raised.

so suggestions on how can create tkinter sliders command scale of x-axis of individual subplots on single figure?

update

perhaps problem in realtimeplotter?

note dsets[figure][subs][data] info points specific subplot; subs should typically left @ '0'.

def realtimeplotter(): global dsets, wscaleslist, wscales2list in range(len(figures_list)): scale in wscaleslist: samples = min(len(dsets[i][0][0]),scale[0].get()) xaxis = pylab.arange(len(dsets[i][0][0])-samples, len(dsets[i][0][0], 1 ) t in range(len(linenum)-1): #we take lineax , axnum[1] because [0] figure number (lineax[t+1])[i].set_data(xaxis,pylab.array(dsets[i][0][t][-samples:]) (axinfo[t+1]).axis([xaxis.min(),xaxis.max(),-1.5,1.5]) canvas in range(len(canvaslist)): canvaslist[canvas].draw() root in range(len(roots)): roots[root].after(100,realtimeplotter)

there no problem illustration below there must in code not able duplicate. when "canvas" sliders on canvas object or figure of speech. also, type of object roots[root].

"only first active , acts 'master slider' controlling 'n' subplots simultaneously" think way possible if point same object.

import tkinter root=tkinter.tk() root.geometry("225x150") slide_length in (200, 150): wscale = tkinter.scale( master = root, label = "view width on plot ", from_ = 3, = 1000, orient = tkinter.horizontal, sliderlength = 30, length = slide_length) wscale.pack(side = tkinter.bottom) root.mainloop()

python matplotlib tkinter

c - Making stdin writable in a safe and portable way -



c - Making stdin writable in a safe and portable way -

i trying run 2 programs.

case 1

#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { int n; int k = 10; int ret_val = 0; ret_val = write (0, &k, sizeof(int)); if (-1 == ret_val) { printf ("failed write"); exit (exit_failure); } scanf ("%d", &n); printf ("integer read %d \n", n); homecoming 0; }

then tried next one.

case 2

#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main() { int n; int k = 10; int ret_val = 0; /* open file content shall inserted stdin_buffer */ int source_fd = open ("file_in.txt", o_creat | o_rdwr, s_irwxu); if (-1 == source_fd) { printf ("failed open file reading"); exit (exit_failure); } int stdin_fd; /* close stdin_fileno */ close(0); /* dup source */ stdin_fd = dup (source_fd); if (-1 == stdin_fd) { printf ("failed dup"); exit (exit_failure); } /* write stdin_buffer (content taken file_in.txt) */ ret_val = write (stdin_fd, &k, sizeof(int)); if (-1 == ret_val) { printf ("failed write stdin_buffer"); exit (exit_failure); } scanf ("%d", &n); printf ("integer read %d \n", n); close(source_fd); homecoming 0; }

now in first case, not able write stdin. in sec case, able take input file, "file_in.txt", , send content standard input buffer.

i couldn't explanation why first case didn't work out. can explain?

stdin should other file right? if write protected, fine. when redirected input (in sec case), there no "permission denied" problem. code seems non-portable. there portable , safe way redirect stdin file?

after going through comments, have come better working code. feedback on code

#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #define len 100 int main() { int n; char buffer[len]; memset (buffer, '\0', len); int ret_val = 0; /* open file content shall inserted stdin_buffer */ int source_fd = open ("file_in.txt", o_creat | o_rdonly, s_irwxu); if (-1 == source_fd) { perror ("failed open file reading"); exit (exit_failure); } /* temp stdin_buffer */ int temp_fd = open ("temp_in.txt", o_creat | o_rdwr, s_irwxu); if (-1 == temp_fd) { perror ("failed open temp stdin"); exit (exit_failure); } int stdin_fd; /* close stdin_fileno */ close(0); /* dup source */ stdin_fd = dup (temp_fd); if (-1 == stdin_fd) { perror ("failed dup"); exit (exit_failure); } ret_val = read (source_fd, buffer, len); if (-1 == ret_val) { perror ("failed read source"); exit (exit_failure); } else { printf ("%s read source file\n", buffer); } /* write stdin_buffer (content taken file_in.txt) */ ret_val = write (stdin_fd, buffer, len); if (-1 == ret_val) { perror ("failed write stdin_buffer"); exit (exit_failure); } ret_val = lseek (stdin_fd, 0, seek_set); if (-1 == ret_val) { perror ("failed lseek"); exit (exit_failure); } ret_val = scanf ("%d", &n); if (-1 == ret_val) { perror ("failed read stdin_buffer"); exit (exit_failure); } printf ("integer read %d \n", n); close(source_fd); homecoming 0; }

before updates

in first program, 3 null bytes , newline (probably) written screen (not in order); programme tries read keyboard (assuming there's no i/o redirection on command line). writing standard input not load input buffer. can write standard input (and read standard output , standard error) because classic technique opens file descriptor o_rdwr , connects standard i/o channels. however, there no guarantee can so. (the first programme needs <unistd.h>, incidentally.)

the sec programme has much undefined behaviour hard analyze. open() phone call needs 3 arguments because includes o_creat; 3rd argument mode file (e.g. 0644). don't check open() succeeds. don't check write succeeds; won't, because file descriptor opened o_rdonly (or, rather, source_fd opened o_rdonly, , dup() re-create mode file descriptor 0), means write() fail. input operation not checked (you don't ensure scanf() succeeds). (the sec programme doesn't need <sys/types.h> or <sys/stat.h>.)

basically, don't know going on because you've not checked of critical function calls.

after update 1

note error messages should written standard error , should terminated newlines.

i first programme working stated (mac os x 10.10 yosemite, gcc 4.8.1), though hard prove null bytes got written standard input (but newline written there). type 10 (or 20, or 100, or …) plus return , integer printed.

the sec programme fails on scanf() because file pointer @ end of file when seek read. can see variant of program:

#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> int main(void) { /* open file content shall inserted stdin_buffer */ int source_fd = open ("file_in.txt", o_creat | o_rdwr, s_irwxu); if (-1 == source_fd) { printf ("failed open file reading\n"); exit (exit_failure); } close(0); int stdin_fd = dup (source_fd); if (-1 == stdin_fd) { printf("failed dup\n"); exit(exit_failure); } int k = 10; int ret_val = write(stdin_fd, &k, sizeof(int)); if (-1 == ret_val) { printf("failed write stdin_buffer\n"); exit(exit_failure); } int rc; int n; if ((rc = scanf("%d", &n)) != 1) printf("failed read standard input: rc = %d\n", rc); else printf("integer read %d (0x%08x)\n", n, n); close(source_fd); homecoming 0; }

it produces:

failed read standard input: rc = -1

if rewind file before reading, 0 returned; binary info written file not valid string representation of integer.

after update 2

i've written little function err_exit() because allows code smaller on page. i've modified code in couple of places study on homecoming value previous function. absence of input not error. when 0 bytes read, isn't error; eof. when there info read isn't text format integer value, no conversions take place, isn't error.

#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #define len 100 static void err_exit(const char *msg) { perror(msg); exit(exit_failure); } int main(void) { int n = 99; char buffer[len]; memset(buffer, '\0', len); int ret_val = 0; /* open file content shall inserted stdin_buffer */ int source_fd = open("file_in.txt", o_creat | o_rdonly, s_irwxu); if (-1 == source_fd) err_exit("failed open file reading"); /* temp stdin_buffer */ int temp_fd = open("temp_in.txt", o_creat | o_rdwr, s_irwxu); if (-1 == temp_fd) err_exit("failed open temp stdin"); /* close stdin_fileno */ close(0); /* dup source */ int stdin_fd = dup(temp_fd); if (-1 == stdin_fd) err_exit("failed dup"); ret_val = read(source_fd, buffer, len); if (-1 == ret_val) err_exit("failed read source"); else printf("(%d bytes) <<%s>> read source file\n", ret_val, buffer); /* write stdin_buffer (content taken file_in.txt) */ ret_val = write(stdin_fd, buffer, len); if (-1 == ret_val) err_exit("failed write stdin_buffer"); ret_val = lseek(stdin_fd, 0, seek_set); if (-1 == ret_val) err_exit("failed lseek"); ret_val = scanf("%d", &n); if (-1 == ret_val) err_exit("failed read stdin_buffer"); printf("integer read %d (ret_val = %d)\n", n, ret_val); close(source_fd); homecoming 0; }

output:

(0 bytes) <<>> read source file integer read 99 (ret_val = 0)

when scanf() fails read value, (usually) doesn't write corresponding variable. that's why 99 survives. if want info can read scanf() integer, need:

#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #define len 100 static void err_exit(const char *msg) { perror(msg); exit(exit_failure); } int main(void) { int n = 99; char buffer[len] = ""; int ret_val = 0; /* open file content shall inserted stdin */ int source_fd = open("file_in.txt", o_creat | o_rdonly, s_irwxu); if (-1 == source_fd) err_exit("failed open file reading"); /* temp stdin */ int temp_fd = open("temp_in.txt", o_creat | o_rdwr, s_irwxu); if (-1 == temp_fd) err_exit("failed open temp stdin"); /* close stdin_fileno */ close(0); /* dup source */ int stdin_fd = dup(temp_fd); if (-1 == stdin_fd) err_exit("failed dup"); ret_val = read(source_fd, buffer, len); if (-1 == ret_val) err_exit("failed read source"); else printf("(%d bytes) <<%s>> read source file\n", ret_val, buffer); /* write stdin (content taken file_in.txt) */ ret_val = write(stdin_fd, "10\n", sizeof("10\n")-1); if (-1 == ret_val) err_exit("failed write stdin"); ret_val = lseek(stdin_fd, 0, seek_set); if (-1 == ret_val) err_exit("failed lseek"); ret_val = scanf("%d", &n); if (-1 == ret_val) err_exit("failed read stdin"); printf("integer read %d (ret_val = %d)\n", n, ret_val); close(source_fd); homecoming 0; }

output:

(0 bytes) <<>> read source file integer read 10 (ret_val = 1)

c stdin portability

CSS: Transition does not work in a firefox extension -



CSS: Transition does not work in a firefox extension -

i have next in css:

#mybox-id { background: transparent; transition: background .5s ease-in; } #mybox-id:hover { background: linear-gradient(to top, rgba(229,95,218,1) 40%, rgba(229,95,218,1) 40%, transparent); }

transition ignored. on mouse over/out, color of linear-gradient appears/disappears instantly. if set in place of linear-gradient single color, e.g. rgba(229,95,218,1) or violet etc, transition works expected: on mouse over/out, color fades in/out gradually.

i have tried background-image , background-color same results.

any ideas on why transition not work in combination linear-gradient? want accomplish.

demo - http://jsfiddle.net/victor_007/bd0ftlml/

you can utilize pseudo element gradient , transition

class="snippet-code-css lang-css prettyprint-override">#mybox-id { background: transparent; width: 100%; height: 500px; position: relative; } #mybox-id:after { content: ""; background: linear-gradient(to top, rgba(229, 95, 218, 1) 40%, rgba(229, 95, 218, 1) 40%, transparent); position: absolute; top: 0; bottom: 0; right: 0; left: 0; opacity: 0; transition: .5s ease-in; z-index: -1; } #mybox-id:hover:after { opacity: 1; } class="snippet-code-html lang-html prettyprint-override"><div id="mybox-id"> <p>dolor sit down amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec,</p> <p>dolor sit down amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec,</p> <p>dolor sit down amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec,</p> <p>dolor sit down amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec,</p> <p>dolor sit down amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec,</p> </div>

css firefox animation background transition

c++ - Class locals as predicates pre C++11 -



c++ - Class locals as predicates pre C++11 -

the next code compiles without errors/warnings when beingness built c++11 mode, using gcc , clang. if effort compile without c++11 mode , error occurs in 2nd scope.

#include <algorithm> #include <vector> struct astruct { int v; }; struct astruct_cmp0 { bool operator()(const astruct& a0, const astruct& a1) { homecoming a0.v < a1.v; } }; int main() { std::vector<astruct> alist; { // works - no errors std::stable_sort(alist.begin(),alist.end(),astruct_cmp0()); } { struct astruct_cmp1 { bool operator()(const astruct& a0, const astruct& a1) { homecoming a0.v < a1.v; } }; // error: template argument uses local type 'astruct_cmp1' std::stable_sort(alist.begin(),alist.end(),astruct_cmp1()); } homecoming 0; }

my question is: c++11 alter allows local struct definition? please point me specific section in standard (section 9.8 perhaps?)

in c++03 function local types not viable template arguments. in c++11 function local types viable template arguments. key quote in c++03 14.3.1 [temp.arg.type] paragraph 2:

the next types shall not used template-argument template type-parameter:

a type name has no linkage ...

in c++11 constraint removed.

the relevant section on when linkage defined 3.5 [basic.link] (in both standard) long , points entities without linkage exclusion, paragraph 8 in c++03:

names not covered these rules have no linkage. ...

types defined within function not listed in "these rules".

c++ c++11 compiler-errors language-lawyer predicate

c# - How to bind a value from a TextBox to the viewmodel in Mvvm Light -



c# - How to bind a value from a TextBox to the viewmodel in Mvvm Light -

i've been working on sample project using mvvm lite , i'm wondering how bind textbox text value , have passed , view view model. first time i've worked mvvm lite i'm new this.

basically user come in project name in text box name , click new project button should generate database named after typed in project name text box.

view :

<usercontrol x:class="sample.views.navigationtree.newprojectview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mui="http://firstfloorsoftware.com/modernui" xmlns:ignore="http://www.ignore.com" mc:ignorable="d ignore" datacontext="{binding newprojectview, source={staticresource locator}}"> <grid> <stackpanel orientation="vertical" horizontalalignment="left"> <stackpanel orientation="horizontal" horizontalalignment="left"> <mui:bbcodeblock bbcode="project name"/> <label width="10"/> <textbox text="{binding projname, mode=oneway, updatesourcetrigger=propertychanged}" width="120"/> </stackpanel> <label height="10"/> <stackpanel orientation="horizontal" horizontalalignment="left"> <label width="85"/> <button content="new project" margin="0,0,3,0" command="{binding addprojectcommand}" isenabled="{binding isuseradmin}" grid.column="2" grid.row="0"/> </stackpanel> </stackpanel> </grid> </usercontrol>

viewmodel:

using sample.model.database; using galasoft.mvvmlight; using galasoft.mvvmlight.command; using system.text; namespace sample.viewmodel { /// <summary> /// class contains properties view can info bind to. /// <para> /// see http://www.galasoft.ch/mvvm /// </para> /// </summary> public class newprojectviewmodel : viewmodelbase { private string _projname; //binding addprojectcommand public relaycommand addprojectcommand { get; set; } private string consoletext { get; set; } private stringbuilder consolebuilder = new stringbuilder(360); /// <summary> /// initializes new instance of newprojectviewmodel class. /// </summary> public newprojectviewmodel() { this.addprojectcommand = new relaycommand(() => addproject()); } public void addproject() { projectdbinteraction.createprojectdb(_projname); } public string projname { { homecoming _projname; } set { if (value != _projname) { _projname = value; raisepropertychanged("projname"); } } } public string consoletext { { homecoming consoletext; } set { consolebuilder.append(value); consoletext = consolebuilder.tostring(); raisepropertychanged("consoletext"); } } } }

so how pass projname binding , view view model?

looks good, need create association between view , viewmodel. basically, set datacontext of view viewmodel.

you can few ways, show two: 1) in code-behind of view, can create instance of viewmodel (viewmodel vm=new viewmodel()) assign this.datacontext=vm; 2) can xaml info templates. this, home view , homevm viewmodel.

in

<window . . . xmlns:homeview="clr-namespace:bill.views" xmlns:homevm="clr-namespace:bill.viewmodels" > <window.resources> <!--home user command , view model--> <datatemplate datatype="{x:type homevm:homevm}"> <homeview:home/> </datatemplate> </window.resources>

the first seems more flexible normal needs...

c# wpf binding visual-studio-2013 mvvm-light

c - How to merge row processing kernel filterring and column processing kernel filterring into single openCL kernel -



c - How to merge row processing kernel filterring and column processing kernel filterring into single openCL kernel -

i have image processing filter implemented using row , column processing in opencl, of processing gets wasted in launching multiple kernels itself.

so can merge these 2 kernel single kernel same functionality , performs improve in intel hd4600 graphics card. details of code given below:-

assumptions: 1. both horizontal , vertical padding done host (c programming) 2. n (filter length 8, width , height 1024 x 1024,filter coefficients generated using generic filters 3. first row , col kernel beingness launched using below api ret |= clenqueuendrangekernel(command_queue, kernel, 2, null, global_ws(1024x1024), null, 0, null,null);

//code:

__kernel void filter_rows(__global float *ip_img,__global float *op_img, int width, int height,int pitch,int n,__constant float *w) { __private int i=get_global_id(0); __private int j=get_global_id(1); __private int k; __private float a; __private int image_offset = n*pitch +n; __private int curr_pix = j*pitch + +image_offset; // apply filter for(k=-n, a=0.0f; k<=n; k++) { += ip_img[curr_pix+k] * w[k+n]; } op_img[curr_pix] = a; } __kernel void filter_col(__global float *ip_img,__global float *op_img,int width, int height,int pitch,int n,__constant float *w) { __private int i=get_global_id(0); __private int j=get_global_id(1); __private int k; __private float a; __private int image_offset = n*pitch +n; __private int curr_pix = j*pitch + +image_offset; // apply filter for(k=-n, a=0.0f; k<=n; k++) { += ip_img[k*pitch +curr_pix] * w[k+n]; } op_img[curr_pix] = a; } void padd_hor(float *ip_img,pad_leng) { //...using simple c programming } void padd_ver(float *ip_img,pad_leng) { //...using simple c programming } void generic_filter(_global float *in_image,__global float *out_image, __global float *temp_image,int width, int height,int pitch,int n, __constant float *wr,__constant float *wc) { padd_hor(in_image,filter_length) filter_rows(in_image,temp_image,width,height,pitch,filter_length,filter_coeff_hor); pad_ver(temp_image,filter_length) filter_col(temp_image,out_image,width,height,pitch,filter_length,filter_coeff_ver); } __kernel generic_filter(_global float *in_image,__global float *out_image,__global float*temp_image, int width, int height,int pitch,int n,__constant float *wr,__constant float *wc) { // ... here need suggetion implement kernel same generic_filter }

your help appreciated optimize filter , best possible result. please allow me know how much max gain can respect c code runs on intel cpu.

thanks , regards vijayky88

c optimization opencl

ms access 2010 - Getting an SQL Error while combining aggregate function with list items -



ms access 2010 - Getting an SQL Error while combining aggregate function with list items -

i've started learning sql recently. we're using ms access (2010, in case). no task have list how many workers list called "radnik" work in different company locations (marked "brod"). wrote down:

select brod, count(*) count radnik order brod;

there 18 people in list, of them have values of 10,20,30,40 or 50, should create table, instance, like:

brod | count 10 | 5 20 | 9 ...

i get, error, though: you tried execute query not include specified look 'brod' part of aggregate function. obivously, i'm doing wrong, i'm still new sql. i'd very much appeciate if explain me why doesn't work , how fixed.

you need group by:

select brod, count(*) count radnik grouping brod order brod;

in short: whenever you're using aggregate function count, other selected columns need in group by clause well.

sql ms-access-2010 aggregate-functions

C: Linux built in linked list in kernel data structures usage -



C: Linux built in linked list in kernel data structures usage -

i attempting add together scheme phone call linux kernel , advantageous utilize built-in linked list modifying task_struct (by adding linked list), , task_struct has quite few struct list_head's in there other purposes. uniformity, stick info structure.

my issue don't understand how utilize structure. see have "struct list_head children" example. however, implementation of construction simple "*next" , "*last".

i've looked examples online , every single 1 says, make

struct node{ int data; struct list_head list; };

but wouldn't indicate info construction should including in task_struct should

struct node list;

?

i don't quite understand how initialize construction contain info contain if utilize list_head.

essentially want add together linked list of scheme calls , tack them on process in form of linked list of char* (readable format).

for now, semantics of obtaining scheme phone call info unimportant... need figure out how linked list working task_struct.

edit: illustration of trying do:

i've obtained list of scheme calls performed function. keeping these in separate char* variables. add together list within processes task_struct keeps track of of these scheme calls.

for example

process 'abc' calls printf ~> equates "writescreen" getchar ~> equates "readkey"

i have userland piece of code has these 2 strings. phone call scheme phone call write (once per tag) "tag" process these scheme calls.

after both calls, task_struct of 'abc' has list

abc->task_struct->tag_list

this list contains "writescreen" , "readkey".

later utilize these tags print list of processes have called writescreen, readkey, etc. implementation of these happen after find out how utilize list appropriately store strings attached process.

so instead of creating list of processes (task_struct) you're trying accomplish list per process.

this means each process have own list, i.e. own list head.

this list store, in add-on next/prev pointers, single piece of data, string (could string or pointer string elsewhere).

the list node therefore:

struct my_node { struct list_head list; char data[100]; // arbitrarily set 100; char* }

the task_struct should augmented new list head:

struct task_struct { // many members contains info process ... struct list_head my_list; }

yes. you'll notice both cases (when process belongs list, , when list belongs process) fellow member same; utilize different.

now, when process created should initialize list head (as each process have new list):

init_list_head(&new_process.my_list);

to insert new node (supposing created it, is, allocated memory , initialized data):

struct my_node *node; struct task_struct *a_process; [... my_node initialized ...] [... a_proccess obtained somehow ...] list_add_tail(&node->list, &a_process->my_list);

to iterate on elements:

struct my_node *p; struct task_struct *a_process // list fellow member name (yes, fellow member name) of list within my_node list_for_each_entry(p, &a_process->my_list, list) { // whatever want p }

edit:

note, however, have other ways trying do, without resorting complex linked lists.

for instance, allocate single char array , encode list of strings means of separating them char (commas, periods, , on). way:

"writescreen,readkey\0"

in case should after buffer limits, never overflow it. on other hand not have take care of allocating , freeing nodes of list.

c linux-kernel kernel

sql - How can I change number of days to date? -



sql - How can I change number of days to date? -

how can alter number of days date in sql server 2008 ?

sample days : 730677. output : 2000-07-11.

you have problem,

the earliest date represented sql sever datetime2 '0001-01-01'

as can see 366 days after "epoch start"

select 730677 - datediff( day, cast('0001-01-01' datetime2), cast('2000-07-11' datetime2));

to perform calculation like

declare @days int = 730677; select dateadd(day, @days - 366, cast('0001-01-01' datetime2));

if need represent days before 366, need alternative.

sql sql-server sql-server-2008 date

java - Arquillian ApplicationDescriptor issues -



java - Arquillian ApplicationDescriptor issues -

i trying arquillian tests running on websphere 8.5 remote. injection not working: pom.xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.arquillian.example</groupid> <artifactid>arquillian-tutorial</artifactid> <version>1.0-snapshot</version> <packaging>jar</packaging> <name>arquillian-tutorial</name> <url>http://maven.apache.org</url> <!-- properties --> <properties> <was_home>c:/usr_local2/ibm/websphere/appserver</was_home> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <profiles> <profile> <id>build-server</id> <properties> <was_home>${was85_home}</was_home> </properties> </profile> </profiles> <dependencymanagement> <dependencies> <dependency> <groupid>org.jboss.arquillian</groupid> <artifactid>arquillian-bom</artifactid> <version>1.1.5.final</version> <scope>import</scope> <type>pom</type> </dependency> <dependency> <groupid>org.jboss.shrinkwrap.descriptors</groupid> <artifactid>shrinkwrap-descriptors-bom</artifactid> <version>2.0.0-alpha-6</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupid>org.jboss.arquillian.junit</groupid> <artifactid>arquillian-junit-container</artifactid> <scope>test</scope> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>org.jboss.arquillian.container</groupid> <artifactid>arquillian-was-remote-8.5</artifactid> <version>1.0.0.final-snapshot</version> </dependency> <dependency> <groupid>org.jboss.shrinkwrap.descriptors</groupid> <artifactid>shrinkwrap-descriptors-depchain</artifactid> <version>2.0.0-alpha-6</version> <type>pom</type> <scope>test</scope> </dependency> <dependency> <groupid>org.jboss.weld</groupid> <artifactid>weld-core</artifactid> <version>1.1.5.final</version> <scope>test</scope> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-simple</artifactid> <version>1.6.4</version> <scope>test</scope> </dependency> <!-- com.ibm.websphere --> <dependency> <groupid>com.ibm.websphere</groupid> <artifactid>was-public</artifactid> <version>8.5.0</version> <scope>system</scope> <systempath>${was_home}/dev/was_public.jar</systempath> </dependency> <dependency> <groupid>com.ibm.websphere</groupid> <artifactid>ws-admin-client</artifactid> <version>8.5.0</version> <scope>system</scope> <systempath>${was_home}/runtimes/com.ibm.ws.admin.client_8.5.0.jar</systempath> </dependency> </dependencies> </project>

i have ejb:

package org.arquillian.example; import javax.inject.inject; import javax.inject.singleton; import java.io.printstream; /** * component creating personal greetings. */ @singleton public class greeter { private phrasebuilder phrasebuilder; @inject public greeter(phrasebuilder phrasebuilder) { this.phrasebuilder = phrasebuilder; } public void greet(printstream to, string name) { to.println(creategreeting(name)); } public string creategreeting(string name) { homecoming phrasebuilder.buildphrase("hello", name); } }

and have arquillian test:

bundle org.arquillian.example; import org.jboss.arquillian.container.test.api.deployment; import org.jboss.arquillian.junit.arquillian; import org.jboss.shrinkwrap.api.archive; import org.jboss.shrinkwrap.api.shrinkwrap; import org.jboss.shrinkwrap.api.asset.emptyasset; import org.jboss.shrinkwrap.api.asset.stringasset; import org.jboss.shrinkwrap.api.spec.webarchive; import org.junit.assert; import org.junit.test; import org.junit.runner.runwith; import javax.ejb.ejb; import javax.inject.inject; @runwith(arquillian.class) public class greetertest { @deployment public static archive<?> createdeployment() { webarchive war = shrinkwrap.create(webarchive.class).addclass(greeter.class).addclass(phrasebuilder.class) .addaswebinfresource(emptyasset.instance, "beans.xml"); system.out.println(war.tostring(true)); homecoming war; } @inject greeter greeter; @ejb greeter greeter2; @test public void shouldbeinjectedcdi() { assert.assertnotnull("cdi injection not working", greeter); } @test public void shouldbeinjectedejb() { assert.assertnotnull("ejb injection not working", greeter2); } @test public void should_create_greeting() { assert.assertequals("hello, earthling!", greeter.creategreeting("earthling")); greeter.greet(system.out, "earthling"); } }

but 1 time start tests failed.

java.lang.nullpointerexception @ org.arquillian.example.greetertest.should_create_greeting(greetertest.java:50) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41) @ org.jboss.arquillian.junit.arquillian$6$1.invoke(arquillian.java:301) @ org.jboss.arquillian.container.test.impl.execution.localtestexecuter.execute(localtestexecuter.java:60) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:145) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:116) @ org.jboss.arquillian.core.impl.eventimpl.fire(eventimpl.java:67) @ org.jboss.arquillian.container.test.impl.client.protocol.local.localcontainermethodexecutor.invoke(localcontainermethodexecutor.java:50) @ org.jboss.arquillian.container.test.impl.execution.remotetestexecuter.execute(remotetestexecuter.java:109) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:145) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:116) @ org.jboss.arquillian.core.impl.eventimpl.fire(eventimpl.java:67) @ org.jboss.arquillian.container.test.impl.execution.clienttestexecuter.execute(clienttestexecuter.java:57) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81) @ org.jboss.arquillian.container.test.impl.client.containereventcontroller.createcontext(containereventcontroller.java:142) @ org.jboss.arquillian.container.test.impl.client.containereventcontroller.createtestcontext(containereventcontroller.java:129) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88) @ org.jboss.arquillian.test.impl.testcontexthandler.createtestcontext(testcontexthandler.java:102) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88) @ org.jboss.arquillian.test.impl.testcontexthandler.createclasscontext(testcontexthandler.java:84) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88) @ org.jboss.arquillian.test.impl.testcontexthandler.createsuitecontext(testcontexthandler.java:65) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:145) @ org.jboss.arquillian.test.impl.eventtestrunneradaptor.test(eventtestrunneradaptor.java:111) @ org.jboss.arquillian.junit.arquillian$6.evaluate(arquillian.java:294) @ org.jboss.arquillian.junit.arquillian$5.evaluate(arquillian.java:269) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:76) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:50) @ org.junit.runners.parentrunner$3.run(parentrunner.java:193) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:52) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:191) @ org.junit.runners.parentrunner.access$000(parentrunner.java:42) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:184) @ org.jboss.arquillian.junit.arquillian$2.evaluate(arquillian.java:193) @ org.jboss.arquillian.junit.arquillian.multiexecute(arquillian.java:345) @ org.jboss.arquillian.junit.arquillian.access$200(arquillian.java:49) @ org.jboss.arquillian.junit.arquillian$3.evaluate(arquillian.java:207) @ org.junit.runners.parentrunner.run(parentrunner.java:236) @ org.jboss.arquillian.junit.arquillian.run(arquillian.java:155) @ org.junit.runner.junitcore.run(junitcore.java:157) @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:74) @ com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:211) @ com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:67) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:94) @ com.intellij.rt.execution.application.appmain.main(appmain.java:134)

i have tried many things. @applicationscoped, @sessionscoped on greeter class. help me out?

edit: here archive

2adbe911-ddef-42b5-bbfe-4d13fe620acd.war: /meta-inf/ /meta-inf/beans.xml /web-inf/ /web-inf/beans.xml /web-inf/classes/ /web-inf/classes/org/ /web-inf/classes/org/arquillian/ /web-inf/classes/org/arquillian/example/ /web-inf/classes/org/arquillian/example/greeter.class /web-inf/classes/org/arquillian/example/phrasebuilder.class

you need have beans.xml file enable cdi. web modules should in web-inf, ejb modules in meta-inf folder.

java websphere jboss-arquillian

android - how to make rectangle view in showcaseview for listview -



android - how to make rectangle view in showcaseview for listview -

i using https://github.com/amlcurran/showcaseview library showcaseview how create rectangle view instead of circle ? , how using 1 of listview item? thanks

1

android listview showcaseview

vb.net - Find Bounds of GDI+ Shape -



vb.net - Find Bounds of GDI+ Shape -

hi i'm trying rectangle surrounds shape drawn via gdi+ when pen thick.

this test code demo added mybase.load test out..

dim bmp new bitmap(500, 500) dim g graphics = graphics.fromimage(bmp) g.clear(color.transparent) g.smoothingmode = smoothingmode.highquality g.pixeloffsetmode = pixeloffsetmode.default ' setup matrix dim mat new matrix mat.translate(100, 100) g.transform = mat ' draw lines , fill dim gp new graphicspath gp.addlines({new point(50, 0), new point(100, 100), new point(0, 100)}) gp.closeallfigures() ' closes open path (ie bring together origin) g.fillpath(new solidbrush(color.beige), gp) ' add together border graphics path g.drawpath(new pen(new solidbrush(color.black), 20), gp) g.drawrectangle(new pen(new solidbrush(color.red), 1), rectangle.truncate(gp.getbounds)) ' tidy g.resettransform() mat.dispose() ' set picturebox value picturebox1.image = bmp

i'd post image forum doesn't allow me.

i want bounding rectangle include pen width too. used above triangle demo cant add together penwidth/2.

any ideas?

julian

if sufficient needs can set pen's .alignment property inset so:

g.drawpath(new pen(new solidbrush(color.black), 20) {.alignment = penalignment.inset}, gp)

this tells pen draw on within of path @ times. default draws on middle leads situation outside width @ edges dependant on angle of edge.

result is:

vb.net

jquery radio button not refreshing -



jquery radio button not refreshing -

this quick question i'm sure i'm sure i'm having brain fart here.

goal. on load select 1 of 2 radio buttons.

problem. visually not show.

i've tried sepreatly , @ same time 2 lines of code.

$("#ssexfemale").attr("checked", true);

$("#ssexfemale").prop("checked", true);

the first line changes

<input type="radio" name="ssex" id="ssexfemale" value="0">

into

<input type="radio" name="ssex" id="ssexfemale" value="0" checked="checked">

but radio button still not checked visually. if manually changed file html starts sec line see radio button selected. did research , found saying use.

$('#ssexfemale').buttonset("refresh");

but generates next error.

uncaught error: cannot phone call methods on buttonset prior initialization; attempted phone call method 'refresh'

this must simple i'm missing. help appreciated. thanks.

jquery radio-button

eclipse - How to resolve an import of a java package in a project? -



eclipse - How to resolve an import of a java package in a project? -

i took source code java application maxim's ibutton onewireviewer. google code repo, found "package" need utilize separate project. java files , not .class or .jar. project, first thing want able run onewireviewer java application through ide (eclipse in case). currently, when seek importing com.dalsemi.onewire.*, eclipse tells me import cannot resolved. how can add together these java files project?

in general, not want include library's source files in project. either add together distribution dependency in build-file, or download distribution , add together project.

if understand question correctly, need little part of onewireviewer. should still include entire distribution .jar, because don't know if classes depend on else in archive.

so, download the onewireviewer distribution, add together lib/onewireapi.jar file zip project in eclipse dependency on build path. should enable import requested package.

java eclipse

How to solve following Relational Algebra query -



How to solve following Relational Algebra query -

on relational algebra exam had yesterday there question couldn't reply , want know how solved. constraint on question wasn't allowed utilize aggregate functions found difficult. schema follows.

employee = {id, name, phone} id pk course of study = {course_no, title, subject} course_no pk completed = {course_no, student_id, grade, semester} {course_no,id,semester} pk

the question went: list pairs of employees have completed same courses , have completed these same courses in same years , have never received grade 'd' in of these courses. list each pair?

if shed lite great.

basically, first build query joins tables form desired list of properties per employee.

then re-create 2 queries , bring together results on course_no , - guess - semester (and remember exclude rows same employee id appears on both sides).

finally filter result grade.

there other variations possible, general idea.

relational-algebra

regex - PHP preg_match found string with no-specified characters -



regex - PHP preg_match found string with no-specified characters -

i have czech dictionary, word per line, need out words contains s,r,t,s,r,t , vowels, prepared regex

if(preg_match("/^[aeiyouaeiyouáéěíýóúůÁÉĚÍÝÓÚŮsrtsrt]*$/", $currentline))

but matches words characters "č,š,ž" too. problem???

php regex

Android libraries performing facebook login, complications -



Android libraries performing facebook login, complications -

we developing android application , sdk(android-library) it. sdk integrated other partner applications. want utilize facebook our login provider across both app , sdk.

our understanding/plan partners need integrate app facebook(create app on developers.facebook.com , etc) , able utilize facebook sdk in our sdk, applicationid. send token on server access /me api facebook id utilize login id our system.

if we(via sdk) phone call fb session open , host application has authenticated fb, getting same token?

are there legal or other issues regarding this? privacy issue?

with facebook? with host application developers? is there way handle purely terms , conditions style stuff?

can somehow request fresh access token permissions need? solve issue?

we considering if able have seperate application id our sdk, wouldnt work because facebook requires associate keyhash application....

are there other instances these of libraries using facebook login? sounds should impossible somehow... otherwise advertisement libraries need integrate fb sdk access want.. came across this recent news article, sounds similar, not sure if is

edit: seems facebook ids application specific now.. bummer - http://code-worrier.com/blog/changes-in-facebook-graph-api-2-dot-0/

android facebook facebook-graph-api

wildcard char for Classpath for java 1.5 -



wildcard char for Classpath for java 1.5 -

i trying compile class in java 1.5 in command prompt. want include jar files folder while using javac. when run below cmd, help gets printed on screen. uncertainty if wildcard chars allowed below java 1.6.

please help.

c:\cfree\52k-br\src\com\checkfree\wps\common\busobj>javac -cp "c:\cfree\52k-br\classes*" iaservice.java

java

javascript - "FB is no defined" inside window.fbAsyncInit -



javascript - "FB is no defined" inside window.fbAsyncInit -

i'm implement editor can dynamic add together facebook button, write code:

utils.insertfacebooksdkjs = function (win) { var document = win.document; win.fbasyncinit = function () { fb.init({ appid: 'app id', // app id version:'v2.0', cookie: true, // enable cookies allow server access session xfbml: true // parse xfbml }); // additional initialization code here }; (function (d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) { return; } js = d.createelement(s); js.id = id; //js.async = true; js.src = "//connect.facebook.net/zh_cn/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); }; $('#add').click(function(){ //add <div class="fb-like"></div> utils.insertfacebooksdkjs(window); });

when user click add together button, function called. throw error: 'fb not defined'.

update: @ utils.insertfacebooksdkjs function, found if pass top window object parameter 'win', fb object fine. pass iframe window object parameter 'win', fb object not defined.

update: problem have solved. because facebook button in iframe. fb object field in iframe window. prepare fb win.fb @ utils.insertfacebooksdkjs

try version:

utils.insertfacebooksdkjs = function () { window.fbasyncinit = function () { fb.init({ appid: 'app id', // app id version:'v2.0', cookie: true, // enable cookies allow server access session xfbml: true // parse xfbml }); // additional initialization code here }; (function (d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) { return; } js = d.createelement(s); js.id = id; //js.async = true; js.src = "//connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); }; document.getelementbyid('add').addeventlistener('click', function() { utils.insertfacebooksdkjs(); });

removed unneccessary variables , changed locale (for testing). avoided jquery because should not utilize basic stuff click listeners imho.

i doing pretty much same in projects, if not work expect error @ different spot , test link may necessary.

javascript facebook

gnuplot - GNU set heatmap axis limits around a dynamically computed point -



gnuplot - GNU set heatmap axis limits around a dynamically computed point -

i'm plotting heatmap in gnuplot text file in matrix format:

z11 z12 z13 z21 z22 z23 z31 z32 z33

and forth, using next command (not including axis labelling, etc, brevity):

plot '~/some_text_file.txt' matrix notitle image

the matrix quite large, in excess of 50 000 elements in bulk of cases, , it's due size of y-dimension (#rows). know if there's way alter limits in y-dimension set number of values around maximum, while keeping x , z dimensions same. e.g. if maximum in matrix @ [4000, 33], want y range centred @ 4000 +- let's 20% of length of y-dimension.

thanks.

edit:

the solution below right idea, works in illustration not in general because bug in how gnuplot uses stats command matrix files. see comments after reply farther info.

you can using stats indices correspond maximum value dynamically.

consider next file named data:

0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 5 3 4 0 1 2 3 4

if run statsi get:

gnuplot> stats "data" matrix * file: records: 25 out of range: 0 invalid: 0 blank: 0 info blocks: 1 * matrix: [5 x 5] mean: 2.1200 std dev: 1.5315 sum: 53.0000 sum sq.: 171.0000 minimum: 0.0000 [ 0 0 ] maximum: 5.0000 [ 3 2 ] cog: 2.9434 2.0566

the maximum value in position [ 3 2 ] meaning row 3+1 , column 2+1 (in gnuplot first row/column number 0). after running stats variables created automatically (help stats more info), stats_index_max_x , stats_index_max_y among them, store position of maximum:

gnuplot> print stats_index_max_x 3.0 gnuplot> print stats_index_max_y 2.0

which can utilize automatically set ranges. now, because stats_index_max_x gives y (instead of x) position, you'll need careful. total number of rows obtain range can obtained scheme phone call (there might improve built-in function, not know):

gnuplot> range = system("awk 'end{print nr}' data") gnuplot> print range 5

so you'll do:

stats "data" matrix range = system("awk 'end{print nr}' data") range_center = stats_index_max_x d = 0.2 * range set yrange [range_center - d : range_center + d]

which center yrange @ position of maximum value , stretch +-20% of total range.

the result of plot "data" matrix w image now

instead of

gnuplot heatmap

cappuccino - CPToolbar renders in the CPBorderlessBridgeWindowMask window only -



cappuccino - CPToolbar renders in the CPBorderlessBridgeWindowMask window only -

i tried add together custom toolbar application. locate @ bottom of window created 1 more window , added toolbar it:

var thewindow = [[cpwindow alloc] initwithcontentrect:cgrectmakezero() stylemask:cpborderlessbridgewindowmask], contentview = [thewindow contentview], bounds = [contentview bounds]; [contentview setbackgroundcolor:[cpcolor colorwithhexstring:@"cecece"]]; ///second window place toolbar @ bottom var w2 = [[cppanel alloc] initwithcontentrect:cgrectmake(0, cgrectgetheight(bounds) - _settings.toolbarsize, cgrectgetwidth(bounds), _settings.toolbarsize) stylemask: cpborderlesswindowmask] var c2 = [w2 contentview] [c2 setbackgroundcolor:[cpcolor colorwithhexstring:@"ff0000"]]; ///a toolbar toolbar = [[toolbar alloc] initwithwindow:w2]; ///show window [thewindow orderfront:self]; [w2 orderfront:self];

it worked cappuccino 0.8.1 not latest one. if either set toolbar thewindow or init w2 cpborderlessbridgewindowmask renders needed.

does have thought reason of behavior?

cappuccino objective-j

shuffle list with repetition constraint 2-back python -



shuffle list with repetition constraint 2-back python -

i have next list:

a=['airplane','track','car','train']

i create list presents every item of list twice, prevents item repetitions next 2 rows. means aeroplane can appear after aeroplane long 2 different items in between b candidate:

b=['airplane','track','car','airplane','train','track','car' etc.]

but c not:

c=['airplane,'track','airplane', etc.]

i thinking of kind of bruteforce operation where: 1. duplicated 2. random.shuffle(a) 3. test repetition (maybe below:

curword[n]==curword[n+1] re-shuffle if true , start over. (i don't know command instruct python read truth value. imagine if statement work, in case of false don't know how i'd instruct python carry on

in case, although getting answers particular questions above own knowledge, can see implementation have considered take long list increases.

any suggestions?

thanks in advance help!

if need list 2 copies of each element, there reason why won't work when original list longer 2 elements?

in [138]: a=['airplane','track','car','train'] in [139]: + out[139]: ['airplane', 'track', 'car', 'train', 'airplane', 'track', 'car', 'train']

if asking more abstract question of, "how sample space of permutations of list elements such don't appear within 2 elements of identical element" next should work.

note getting construction elements appear twice easy a + a , can worry restricting permutations of a + a -- no need overthink "how 2 of each" part of problem.

import random def valid_duplicate_spacing(x): i, elem in enumerate(x): if elem in x[i+1:i+3]: homecoming false homecoming true def sample_permutations_with_duplicate_spacing(seq): sample_seq = seq + seq random.shuffle(sample_seq) while not valid_duplicate_spacing(sample_seq): random.shuffle(sample_seq) homecoming sample_seq

then can used follows:

in [165]: sample_permutations_with_duplicate_spacing(a) out[165]: ['airplane', 'train', 'track', 'car', 'train', 'track', 'car', 'airplane'] in [166]: sample_permutations_with_duplicate_spacing(a) out[166]: ['train', 'airplane', 'car', 'track', 'train', 'airplane', 'track', 'car']

if you're talking simply randomly sampling list, such sample not replaced 2 next draws, utilize generator:

import random def draw_with_delayed_replacement(seq): drawn = random.choice(seq) rejectables = [drawn] yield drawn drawn = random.choice(seq) while drawn in rejectables: drawn = random.choice(seq) rejectables.append(drawn) yield drawn while true: drawn = random.choice(seq) if drawn in rejectables: go on else: rejectables.pop(0) rejectables.append(drawn) yield drawn

then can following:

in [146]: foo = draw_with_delayed_replacement(a) in [147]: foo.next() out[147]: 'car' in [148]: foo.next() out[148]: 'train' in [149]: foo.next() out[149]: 'track' in [150]: foo.next() out[150]: 'car' in [151]: foo.next() out[151]: 'train' in [152]: foo.next() out[152]: 'track' in [153]: foo.next() out[153]: 'car' in [154]: foo.next() out[154]: 'airplane' in [155]: foo.next() out[155]: 'track' in [156]: foo.next() out[156]: 'train'

however, in case can't guarantee you're going sample each element appears twice, , may inefficient little lists.

python shuffle

list - Sharepoint calculated column based on other columns #NULL! error -



list - Sharepoint calculated column based on other columns #NULL! error -

i trying add together 2 currency columns in calculated column getting #null! error.

this seems pretty straightforward first time doing in sharepoint.

sharepoint 2010 excel services available.

have create list required columns:

approved value column type = currency

pending value column type = currency

total value column calculated (calculation based on other columns) type = currency formula: =[approved value]+[pending value]

the values in other columns indeed currency, total shows #null! items.

i can't see done incorrectly.

what should looking resolve problem?

try using isblank function check if of value null.

reference: isblank function

list sharepoint calculated-columns