Posts

Showing posts from September, 2011

java - Tomcat caters to multiple user with same memory - JSP -

i have jsp web application, when try deploy tomcat server, , try run application different machines, dont new pages every user. my application takes input html input , keep in memory press of button, ao push values in memory , keeps untill reset pressed. problem comes when goto machine , run application, same modified page previous user. i have used session management keep username in session. if application not creating new session every new user request. eg: main.jsp has input fields , when click 'add' values html input stored in memory objects, , showed in html inputs till memory not cleared. now machine, access application , go main.jsp, there prefilled html input boxes. why not getting new page everytime go different machine. tomcat server serves users same memory space? sample code main.jsp <%@ page import="test.databaseaccessconnectionmanager" %> <%@ page import="test.functionkeywordmanager" %> <%@ page impo

c# - create multiple threads and communicate with them -

i have program, takes long time initialize it's execution rather fast. it's becoming bottleneck, want start multiple instances of program (like pool) having initialized, , idea pass needed arguments it's execution, saving initialization time. the problem found howto start new processes passing arguments: how pass parameters threadstart method in thread? but start process , able communicate send each thread needed paramenters required it's execution. the best aproach found create multiple threads initialize program , using communication mechanism (named pipes example it's running in same machine) able pass arguments , trigger execution of program (one of triggers break infinite loop, example). i'm asking if can advice more optimal solution rather 1 came with. i suggest don't mess direct thread usage, , use tpl, this: foreach (var data in your_initialization_logic_method_here) { task.run(() => yourdelegate(data), //other param

Setting all the values of the objects to double type in R session -

how can 1 set objects/outputs' values double in r session. suppose a vector , should return double values if elements integers. after suppose if define matrix, mm elements in matrix should appear double. e.g. suppose mm matrix mm=matrix(1:10, nrow=2) > mm [,1] [,2] [,3] [,4] [,5] [1,] 1 3 5 7 9 [2,] 2 4 6 8 10 my desired output is: > mm [,1] [,2] [,3] [,4] [,5] [1,] 1.0 3.0 5.0 7.0 9.0 [2,] 2.0 4.0 6.0 8.0 10.0 can answer this? thank much. try: mm <- matrix(as.double(1:10), nrow=2) check via typeof(mm) # "double"

php - Finding a page for text amends in a Magento shop -

i've been asked change text on appears static page on magento powered site. page located @ /delivery . the /delivery url publicly accessible. don't know lives within system. i'm not sure whether page lives in file or being brought in through magento framework database or other. within magento admin panel there no pages menu in cms dropdown. furthermore, there aren't references /delivery in catalogue > url rewrite management . i have root access server, site not built me need tread carefully. far can tell there no specific rewrites /delivery in apache2 configurations. would try grep specific piece of text on page, whole site around 20gb mark, want narrow down possibilities first. what other avenues of investigation magento or other developer exhaust find text before trying in touch original developers? if it's definately not cms page, try running on shell grep -r '<frontname>delivery</frontname>' /path/to/site/app

opengl es - How to pass arrays of values as uniform and how to create texture in cocos2djs -

i have been these days trying implement shader functionality not find solution. not know @ state shader support not know if going ask possible: 1.- how pass arrays of values shader. i find there functions wrote web not native. example: setuniformlocationwith2fv this may want not defined @ native. there way pass array of floats shader? uniform objetive this: uniform vec2 position[30]; 2.- alternatively 1. pass texture personalized values great too. so question how create texture(1d or if that's not possible 2d or 3d), , pass uniform. i have seent ogl test creates texture not seem cc.texture2d var texture = this.my_texture = gl.createtexture(); gl.bindtexture( gl.texture_2d, texture ); var pixels = new uint8array(4096); for( var i=0; i<pixels.length; ) { pixels[i++] = i/4; // red pixels[i++] = i/16; // green pixels[i++] = i/8; // blue pixels[i++] = 255; // alpha } gl.teximage2d(gl.texture_2d,

multithreading - Code in button click c# happens after the function finishes -

i have simple c# code triggered on button press. button press first clears listboxes, changes text of label, , calls function. private void button1_click(object sender, eventargs e) { listbox1.items.clear(); listbox2.items.clear(); listbox3.items.clear(); listbox4.items.clear(); label5.text = "getting links..."; process(url); label5.text = "finished"; } but lists cleared , label changed after process() finished executing. ruins purpose i'm changing label user aware action taking place. how can make initial label change before function process() finishes? if process method long-running, can cause ui freezing , prevent ui redrawing - that's why don't see label text immediate update. simpliest way achieve goal - call label5.refresh() right after label5.text = "getting links..."; , cause invalidation , redrawing of label. or can call this.refresh() if more 1 control should updated - update whole

node.js - Generic route handlers for express -

i trying make generic handlers rest style routes in express app. they defined in object merged properties defined in specific route files. merging of properties working fine. issue have in somehow passing model object handler's anonymous function. the code below clearest attempt showing i'm trying do, fails model lost in anonymous function's scope. /** * model mongoose model object */ routedefinitions: function (resourcename, model) { routepath = api_prefix + resourcename.tolowercase(); var routeproperties = { getbyid: { method: 'get', isarray: false, auth: true, url: routepath + '/:id', handlers: [function (req, res, next) { model.findbyid(req.param('id')).exec(res.handle(function (model) { console.log(model); res.send(model); })); }] }, getall: { me

jquery - Select only one checkbox in group -

i need in html select 1 checkbox in group. find example. can't realize it. doesn't works. here example: example here code html: <div> <li> <div class="radio"> <label> <input type="checkbox" name="mobil[1][]" id="optionsradios1" value="1" checked class="radi"> Сотовый телефон имеется </label> </div> </li> <li> <div class="radio"> <label> <input type="checkbox" name="mobil[1][]" id="optionsradios2" value="0" class="radi"> Сотовый телефон не имеется </label> </div> </li> <div> and cod

android - achartengine time chart set initial range -

Image
solution instead of using setinitialrange() had set initial x-values using setxaxismin() setxaxismax() . little bit confusing, think. original question i'm working on project involving acharteninge library drawing time diagrams works excellent far. user capable of switching between various graphs (one xymultipleseriesdataset plus 1 timeseries per graph) via separate buttons. far, achartengine displays x values when graph shown. however, asked display data captured in first 3 hours when graph shown, information relevant. nevertheless, user should still able scroll data captured after first 3 hours meaning limiting x-axis maximum value not option. for example: there 2 curves. first curve drawn using data captured on period of 4 hours, while second curve created out of data captured on 18 hours. in current version programme displays data of graph gets displayed meaning first curve shows 3 hours of relevant data while 1 hour of not important information shown too. &qu

How to control references between elements in XML -

Image
in previous question ( how create references between elements in xml ) asked how create, in xml schema, references between elements. ok, noticed something. example, defining these 3 types of vehicles: <car id="car1"> <plate>aaa</plate> <mark>peugeot</mark> <model>206</model> </car> <truck id="truck1"> <plate>bbb</plate> <mark>scania</mark> <model>x1</model> </truck> <trailer id="trailer1"> <plate>ccc</plate> <mark>scania</mark> <model>t1</model> </trailer> ... can define complex vehicle , example: <trailertruck id="tt1"> <car refid="car1"/> <trailer refid="trailer1"/> </trailertruck> <trailertruck id="tt2"> <truck refid="truck1"/> <trailer refid="trailer1&

c# - How to pass data from childform to parentform -

i have 2 forms ,form1 , form2. form1 - parent form2 - child form1 contains following, textbox - loads file path, datagridview - loads file data, buttonnext -when button cliked opens form2, form2 contains following, browsebutton - broswe file directory textbox - shows path buttonfinish - tabes form1 *now want access datagridview form1(parent) form2(child). can broswe file on form2 , when click finish can see file path on form1(parent) textbox no databeing loaded. how can load data on form1 datagridview ? this code far.. form2. public frminputfile(frmmain_page _frmmain) { initializecomponent(); this._frmmain = _frmmain; } private void btnbrowse_click(object sender, eventargs e) { browsefile(); } private void btnfinish_click(object sender,eventargs e) { _frmmain.setfilepath(txtinputfile.text); _grid.rows.clear(); //cant grid form1 string pathselection = ""; if (txtinputfile

java - GWT deferred binding not working after compilation -

i trying implement deferred binding using generators. when testing deferred binding in dev mode works expected, when switching production deferred binding not working reason. have following classes public class generatortest implements entrypoint { //should modified generator public static class generatortestprefs extends preferencesimpl { ... } ... } public class preferencesimpl implements preferences { ... } public interface preferences { public void load(string key, storage storage); public void store(string key, storage storage); } and following definition in gwt module.xml <generate-with class="com.xxx.xxx.gwt.generator.server.preferencesgenerator"> <when-type-assignable class="com.xxx.xxx.gwt.generator.client.preferences"/> </generate-with> i added log classes created generatortestprefs prefs = gwt.create(generatortestprefs.class) in case of dev mode, in log file, see gwt is using class created g

regex - Regular Expression Split on character not in Qualified String (python) -

i use assistance easy familiar. i'm trying parse more/less shop-brewed configuration files dictionary/json. have python code using string procedures or re.split() works fine i've tested against; however, know there corner cases could break , create generic regular expressions better handle logic, , same regex portable other languages (perl,awk,c,etc) use @ work consistent. i looking either use re.match() or re.split() in python. the patterns i'm looking should following: 1) split str on first ? if ? not in substring qualified single and/or double quotes. strin: ''' foo = 'some',"stuff?",'that "could be?" nested?', ? still capture this? , "this?" ''' listout ['''foo = 'some',"stuff?",'that "could be?" nested?', ''' , ''' still capture this? , "this?"'''] 2) split str on first # if # not in substr

javascript - how do i pass js variable in the where clause rails 4 -

<div class="field"> <%= f.label :section_id %> <%= f.select :section_id,options_from_collection_for_select(section.all, :id, :name )%> </div> <div class="field"> <%= f.label :sub_section_id %> <div id="sub_section_div"></div> </div> <div class="actions"> <%= f.submit %> </div> <script type="text/javascript"> $(document).ready(function(){ $("select#sub_section_section_id").change(function(){ var id_value_string = $(this).val(); **$('#sub_section_div').html('<%= j f.select :name,options_from_collection_for_select(subsection.where(:section_id=>1), :id, :name )%>');** }); }); </script> <% end %> i have 2 dropdowns section , subsection in view page.when select section want populate respective sub-section. problem want pass id_value_strin

javascript - Difference between callback hell and nested promises -

i started working nodejs , mongodb(using monk). when came across term "callback hell". in code doing same thing. example- dbcall(d1, function(e, docs){ if(docs.length!=0) dbcall(d2, function(e, docs1){ if(docs1.length!=0) dbcall(d3, function(e, docs2){ //doing docs,docs1,docs2 }) }) }) this when started reading on "promises", , came across article - https://strongloop.com/strongblog/promises-in-node-js-with-q-an-alternative-to-callbacks/ since needed both docs , docs1 inside third callback used nested promises. dbcall(d1) .then(function(docs){ if(docs.length!=0) return dbcall(d2) .then(function(docs1){ if(docs1.length!=0) return dbcall(d3) .then(function(docs2){ //doing docs,docs1,docs2 }) }) }) from above code snippet have following questions(/doubts) : apart making code more readable, promises have performance benefits? nesting promises , callback hell looks similar me. there d

c# - How to publish a project with extern Data correctly -

i'm trying publish project needs data stored in .txt file. the file located in bin\debug. path streamreader relative using applicaton.startuppath. added .txt file solution explorer, somehow bad path error message every time try start published setup. how publish project needed .txt file? you have various ways of achieving this. the txt file included in solution file have property called build action. change content , should published deployments. you can add resources, need access differently. add installation package

python - Sum slices of consecutive values in a NumPy array -

let's have numpy array a containing 10 values. example situation here, although repeat same array length 100. a = np.array([1,2,3,4,5,6,7,8,9,10]) i sum first 5 values followed second 5 values , on , store them in new empty list b . so b contain b = [15,40] . how go doing it? try list comprehension: b = [sum(a[current: current+5]) current in xrange(0, len(a), 5)] it takes slices of 5 @ time list, sums them , constructs list. works lists aren't multiple of 5 in length. ( xrange should range in python3+)

google app engine - Access AppEngine through Chinese Friewall -

This summary is not available. Please click here to view the post.

android - Fragment OnStop() Called when the Fragment is no longer started? -

i confused documentation fragments http://developer.android.com/reference/android/app/fragment.html#onstop() called when fragment no longer started. as know if user navigates backward or fragment replaced/removed onstop() called. can explain me how onstop() called when fragment no longer started?

c# - Programmatically Creating and Populating Multiple Listboxes in Grid -

goal: create listbox each parameter on ssrs report. currently, code works fine if report has 1 parameter. idea populate list of validvalue objects , add labels listbox. should happen each parameter. how programmatically create multiple list boxes, populate them using foreach statements, , add them grid? here's code: reportparameterinfocollection parameters; parameters = reportviewer.serverreport.getparameters(); list<string> labels = new list<string>(); list<validvalue> paramlist = new list<validvalue>(); listbox boxbox = new listbox(); foreach (reportparameterinfo param in parameters) { paramlist = param.validvalues.tolist(); labels.clear(); boxbox.items.clear(); foreach (validvalue val in paramlist) { labels.add(val.label + " - " + val.value); } foreach (string lab in labels)

Get User Token and Secret with Google API in Android -

first of i'm noob android developer. came ios background , see android development driving me little crazy, apologies if i'm ask dumb question. i succesfully implemented "sign in google+" login in app , need information logged user. here can see data retrieved him. @override public void onconnected(bundle bundle) { log.d(tag, "connected google"); string accountname = plus.accountapi.getaccountname(mgoogleapiclient); log.d(tag, "user email: " + accountname); if (plus.peopleapi.getcurrentperson(mgoogleapiclient) != null){ person user = plus.peopleapi.getcurrentperson(mgoogleapiclient); log.d(tag, "user name: "+ user.getname().getgivenname()); log.d(tag, "user image: " + user.getimage().geturl()); log.d(tag, "user id: " + user.getid()); } } but need 2 more things: user's access token , user's access secret . i did similar on ios app i'm lost t

jquery - mouseenter and leave with slide -

i want slideup div when mouse hit minimized element , slide down when user leaves it: $('#managerpane').mouseenter(function(){ $('#managerpane').height(300).slideup(); }); $('#managerpane').mouseleave(function () { $('#managerpane').height(60).slidedown(); }); <div id="managerpane" style="position:absolute;left:10px;bottom:0px;z-index:1000;height:60px; background:white; overflow-x: auto; max-width: 76%;" > <div>.childs..</div> </div> the div slides , down. what's wrong? during slideup div height becomes 0 (slowly) mouse pointer no longer on div. on next mouse move leave event triggered , hence slidedown,mouse again comes on div. result in multiple mouseenter mouseleave events , hence div goes , down. when mouse moved triggers mouseenter event height increased 300 slidesup height animated 0 which leaves mouse outside div when mouse moved triggers mouseleave event height =

bash - Shell Script - telnet multiple hosts:ports -

i'm not expert in shell script means. got structure idea post ( bash script telnet test multiple addresses , ports ) need verify lan connections between specific hosts , ports via telnet. the reason using telnet fact both lan , machines heavily secure , don't have access netcat, nmap or /dev/tcp. i'm no near comfortable python or pearl try route... ( know silly me, i'll there though :p ). the following code works, reasons beyond understanding while loop iterates once , no more... :( . note: important me know if connection failed due timeout or refused (port closed @ endpoint). can me in 1) fixing , 2) understanding why? fyi: else might have similar need here's operational updated code script. in case connection refused being handled success (testing firewall rules) can changed failed depending on necessities. #!/bin/bash path=`pwd`; touch $path/test_telnet.out || exit; touch $path/success.log || exit; touch $path/failed.log |

javascript - primefaces jquery ui tabs -

context : trying use jquery ui plugins (tabs , dialog) in primefaces application directly javascript (due requirement). problem : getting 'length undefined' , 'undefined not function' errors on calls. more specifically, $("#id").tabs() throwing error. what did : search in stackoverflow; checked $.fn.* , $.ui.* in console; surprisingly lot of ui plugins available (datepicker, droppable, selectable) dialog , tabs seem missing. $.ui.version 1.11.3. tried using outputscript , directly <script> tags include jquery ui, none seemed include these plugins; tried noconflict. additional info : worked @ point intermittently.. not sure caused work , preventing working now. spent lot of time troubleshooting this. advance time , shall drop additional info if required. primefaces contains customized (subset) of jquery-ui components. others have added you. , make sure use them compatible version. compatible jquery version primefaces uses. including

How to add an arbitrary number of rows to a database in ASP.net MVC 4? -

i'm trying add unspecified number of rows database. these rows created dynamically user's request: $(document).ready(function () { $(document).on('click', '#datatable .add', function () { var row = $(this).closest('tr'); if ($('#datatable .add').length <= 100) { var clone = row.clone(); // clear values. var tr = clone.closest('tr'); tr.find('input[type=text]').val(''); $(this).closest('tr').after(clone); } }); // delete row if there exists more one. $(document).on('click', '#datatable .removerow', function () { if ($('#datatable .add').length > 1) { $(this).closest('tr').remove(); } }); }); so far using try , achieve list maximum value of 100 elements (which i'd prefer different method this, perhaps 1 no upper limit in meantime),

web scraping - Unordered .csv fields in scrapy -

i developing spider several fields scrapy framework. when export scrapped fields .csv file, fields (or columns) unordered, not defined them in items.py file. does know how solve issue? thanks in advance. class myspider(basespider): filehandle1 = open('file.xls','w') --------------- def parse(self, response): ----------- self.filehandle2.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n"%(item['a'],item['h'],item['g'],item['f'],item['e'],item['d'],item['c'],item['b']))

algorithm - Merging sorted lists without comparison key -

say have following lists: list 1: x, y, z list 2: w, x list 3: u and want merge them such order among each individual list respected. solution above problem might w, x, y, z, u . this problem easy if have comparison key (e.g. string comparison; < z), gives reference element's position relative other elements in combined list. case when don't have key? above problem, restate problem follows: x < y , y < z , w < x x, y, z, w, u in {0, 1, 2, 3, 4} the way i'm solving type of problem model problem constraint satisfaction problem -- run ac3 arc consistency algorithm eliminate inconsistent values, , run recursive backtracking algorithm make assignments. works fine, seems overkill. is there general algorithm or simpler approach confront type of problem? construct graph node every letter in lists. x y z w u add directed edge letter x letter y every pair of consecutive letters in list. x -> y -> z ^ | w u topologically

knockout.js - Knockout checked and click both (prevent double checkbox switch) -

i have checkbox described this: <input id="checkbox1" type="checkbox" data-bind=" click: function () { handle_compare($element) }, checked: is_product_compared"> .handle_compare() inverts observable "is_product_compared", problem allow normal behavior checkbox, if click on it, seems double switches, , never see changes. if bind handle_compare button - ok, checkbox switches normally. there way allow both bindings? you can see demo here, button ok, checkbox has wrong behavior. http://jsfiddle.net/g5rpcw2c/1/ you need inline click handler return true: http://jsfiddle.net/g5rpcw2c/2/ either: <input id="checkbox1" type="checkbox" data-bind=" click: function () { handle_compare($element); return true; }, checked: is_product_compared"> or (since handle_compare returns true): <input id="checkbox1" type="checkbox" data-bind=" click: f

ios - CALayer Subclass Repeating Animation -

i'm attempting create calayer subclass performs animation every x seconds. in example below i'm attempting change background 1 random color when running in playground nothing seems happen import uikit import xcplayground import quartzcore let view = uiview(frame: cgrect(x: 0.0, y: 0.0, width: 200, height: 200)) xcpshowview("view", view) class customlayer: calayer { var colors = [ uicolor.bluecolor().cgcolor, uicolor.greencolor().cgcolor, uicolor.yellowcolor().cgcolor ] override init!() { super.init() self.backgroundcolor = randomcolor() let animation = cabasicanimation(keypath: "backgroundcolor") animation.fromvalue = backgroundcolor animation.tovalue = randomcolor() animation.duration = 3.0 animation.repeatcount = float.infinity addanimation(animation, forkey: "backgroundcolor") } required init(coder adecoder: nscoder) {

Flatten Nested XML/hierarchy using XSLT Transformation -

i have nested hierarchial xml structure flattened using xsl transformation. following scenario. <company> <managers> <manager> <name>matt</name> <id>1</id> <manager> <name>joe</name> <id>11</id> <manager> <name>dave</name> <id>111</id> </manager> </manager> </manager> <manager> <name>mike</name> <id>2</id>> </manager> </managers> </company> result: matt 1 joe 11 dave 111 mike 2 a better alternative via @mathias mueller, <?xml version="1.0" encoding="utf-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:output method="text" encoding="utf-8"/> <xsl:te

Stop Ajax Events in Drupal 7 Form -

i'm faced drupal 7 problem , built-in ajax framework. fields registered step step when user fills them , final check made when form submitted (without js time). i'm using #ajax callback every field except submit button: $form['myfield'] = array( '#type' => 'textfield', '#default_value' => 'test', '#title' => 'test', '#ajax' => array( 'callback' => '_form_submit_callback', 'wrapper' => 'name-error-icon-container', 'method' => 'html', 'effect' => 'none', 'progress' => array( 'message' => null, ), ) ); //edit: callback asked function _form_submit_callback($form, &$form_state) { form_state_values_clean($form_state); //remove unuseful values $form_state['values'

objective c - Xcode 6 not respecting autolayout constraints -

i had wanted storyboard files scale size of simulator/device screen. unable figure out how in xcode 6. alternative idea, then, place constraints on buttons within project using interface builder. placed constraints on buttons--for example, attempted place centering constraint on 1 button clicking on background of view , connecting button (and selecting "center horizantally in container"). when run program, button doesn't re-center. same applies constraints place of trailing edges. xcode ignores of them. if run iphone 6 simulator, buttons don't increase space fill simulator (they "scale up" in sense of size, don't move themselves). doing wrong? make sure constrains lines blue (not orange , have no warning saying button show different @ running time. if have of these problems starting step delete bad (oranges) constrains , use "add missing constrains" re run project , check layout. another way delete constrains , use "add sugg

reference to ODC in excel with C# -

i trying create reference .odc file in excel. (the actual connection string saved in .odc file). file path(root/trusted domains/connections or something) , file name entered. idea upload excel to, sharepoint, , have pivot table automatically refresh data source. using c#. should use openxml or microsoft.office.excel.interop? have example of sort? i'm no expert in xml(reading, writing, look).

mysql - merge two large tables with unique values -

i have large tables, main 1 (tablea) around 14 million records , second 1 want merge 20 million records (tableb). part first subset of second. i tried making unique index using 2 or 3 fields combined identify records such mysql wouldn't it. i made own field 'unique' concatenating 3 fields. my question how import tableb tablea using unique records i.e. ones value in unique field in tableb not exist in unique field in tablea. since not make unique field actual unique index will/should try make each 1 pk , or ordinary index in respective tables? any thoughts on how efficiently appreciated. use sql union statement. "select * tablea join tableb"

c++ - Running an infinite loop because of next_permute -

i trying solve problem input 2 vectors of different lengths , add scalar product. minimun scalar product problem https://code.google.com/codejam/contest/32016/dashboard#s=p0 . i'm apparently hopelessly running infinite loop.probably because of permutation.but don't understand why . #include "stdafx.h"; #include <algorithm> #include <fstream> using namespace std; //output stuff int cases[100]; int casesol[100]; int ncase; void output() { (int = 1; <= ncase; i++) { printf("case #%d: %d\n", i, casesol[i]); } } //output stuff end int product; int v1[100]; int v2[100]; int minimum; int main() { // read in number of cases freopen("file.in", "r", stdin); freopen("file.out", "w", stdout); scanf("%d", &ncase); // read in misc problem constants (int = 1; <= ncase; ++i) { int vector_size; scanf("%d", &vector_size

knockout.js - Breeze Project - Null Fields Removed -

if run breeze projection query: var item; breeze.entityquery .from("sometable") .where("id", "==", id) .select("a, b, c, d") .using(myentitymanager).execute() .then(function(data) { item = ko.observable(data.results[0]); }); and row in table, b , c null, i'll object without b , c. { a: "somevalue", b: "someothervalue" } in ui have: <div data-bind="with: item"> <span data-bind="text: a" /> <span data-bind="text: b" /> <span data-bind="text: c" /> <span data-bind="text: d" /> </div> i error - referenceerror: unable process binding "with: function(){return item}" message: unable process binding "text: function(){return b}" message: 'b' undefined am missing something? how can b , c in results, value of null? here situation, modeled after northwind sample database available i

c# - NamedPipeClientStream AccessViolation -

Image
i came across issue today constructor of namedpipeclientstream threw av. after boiling down try , minimal repeatable example found... create new project in vs2013 update 4 (console do) targeting .net 3.5 change main this.... static void main(string[] args) { var pipe = new namedpipeclientstream(".", "global\\turnips", pipedirection.inout, pipeoptions.asynchronous); } run. anyone have idea what's going on here? i've looked through code in ctor of named pipe using ilspy , can't see reason behaviour.

data binding - SAPUI5 / OpenUI5 Databinding for Custom Controls -

i'm working sapui5 , openui5. i'ved developed custom controls never used 2-way databinding controls...i've tried omycontrol.bindproperty("somevalue", "omodel>/testbindingvalue") what i've seen is: when watching model in debugger field abindings have 1 entry: spath: "/testbindingvalue" sinternaltype: "int" and correct sinternaltype of controls property type (in case "int"). but when i'm watching array omodel.odata empty , omodel.getproperty("/testbindingvalue") returning undefined...but control has value "somevalue"...so, have idea? thanks, alex update: here see workflow: first creating model: var omodel = new sap.ui.model.json.jsonmodel(); sap.ui.getcore().setmodel(omodel, 'omodel'); then initializing control: var omycontrol = new mycontrol({ somevalue: "test value of control" }); omycontrol.bindproperty("somevalue", "o

javascript - Black image bug when exporting highcharts in Firefox -

i using highcharts display several graphs on webpage display fine. i have export function tries combine charts pdf. getting svg of chart , converting jpeg image included in pdf created jspdf. here code using generate images: if ($('.chart').length > 0) { var chartsvg = $('.chart').highcharts().getsvg(), chartimg = new image(); chartimg.src = "data:image/svg+xml;base64," + window.btoa(unescape(encodeuricomponent(chartsvg))); var chartcanvas = document.createelement("canvas"); chartcanvas.width = 600; chartcanvas.height = 400; chartcanvas.getcontext("2d").drawimage(chartimg, 0, 0, 600, 400); var chartimgdata = chartcanvas.todataurl("image/jpeg"); } this works in chrome in firefox returns black image. does know might going wrong or has seen similar issue? thanks help. update i've updated code no image appended pdf document, either in chrome or firefox. if ($('.s

c++ - How to manage 100 different main files? -

short version of question: is there way set visual studio solution build 100 different main files contained in single code base, , in single visual studio project? long version of question: i work legacy corporate signal processing library. the functions in clean, written, highly optimized, , in ansi c. (yes, know of attributes contradictory) have vs project build library, , publish other projects/groups in company using our corporate code publishing system. each "big" library entry point has it's own source file. each of these "big" entry points has thin main wrapper function defined in file, #ifdef foomain /* main function foo */ main() { } #endif i have learned these "little" apps used many people around company. so, include these apps in our publishing process. (at present published via manual door means.) using vs solutions, , curious if can there?

.net - Windows azure price calculation and estimation (for mobile) -

i'm sorry ask don't find correct answer in resources found. easiest way calculate price , needs (mobile services, cloud services, vm, etc...). simple poc of windows mobile app, orchestration (using signalr, maps, db, etc....), lot , best regards, n. well, team of windows azure excellent job , give answer questions. professionalism enjoyable.

Mendix: The FileManager widget and uploaded file extensions -

when using filemanager widget upload files, backing filedocument entity contain binary contents of uploaded file , metadata file. problem don't know within filedocument entity can find uploaded document's file extension. see there filedocument attribute called "name", value doesn't contain file extension. example, when uploading "myfile.txt" name attribute "myfile". know full name being persisted somewhere assume there easy way me grab it, don't know look. need full file name extension because storing newly uploaded document remote file-server via web-service. thanks. the name attribute you're looking for. contains full file name , extension. somewhere in application, name getting changed or extension stripped off.

Execute multiple exchange online cmdlets using C# , ASP.NET with only 1 runspace -

i working on asp.net webapplication can connect exchange online , run commandlets. the following working codebehind single button, gets list of mailboxes in asp.net protected void finalconnection_click(object sender, eventargs e) { string username = ""; string password = ""; securestring securestring = new securestring(); foreach (char pass in password) { securestring.appendchar(pass); } pscredential pscred = new pscredential(username,securestring); wsmanconnectioninfo connectioninfo = new wsmanconnectioninfo(new uri("https://ps.outlook.com/powershell"), "http://schemas.microsoft.com/powershell/microsoft.exchange", pscred); connectioninfo.authenticationmechanism = authenticationmechanism.basic; connectioninfo.maximumconnectionredirectioncount = 2; using (runspace runspace = runspacefactory.createrunspace(connectioninfo)) {

sql - Create a database view in HANA with data types defined -

when using hana sqlscript possible create view data types defined or need cast type in every select statement being used? running implicit data type issues hana doesn't seem evaluating data being used. when create view data type defined syntax errors wondering if possible. on hana revision 84. --trying create view datatype defined create view testview ( measure1 decimal(25,10) ) select 4493.3489212 dummy --creating view casting type in select statement create view testview (measure1) select cast(4493.3489212 decimal(25,10)) dummy when creating sql views via create view, you're not using sqlscript standard sql. , standard sql doesn't have explicit output structure definition, you're depending on data types create in select statement (e.g. via cast()). when dealing actual sap hana information models (e.g. scripted calculation view) explicitly define output structure (semantics tab).

jsf - All tabs of tabpanel refreshed, when event happens in any one of the tab (Richface 3.3.4) -

we have tabpanel has multiple tabs. when event performed in of tabs (e.g. click 'ajaxsubmit' button in tab1) tabs refreshed causing performance issues (e.g. getter of 'table' value invoked tab3). we tried wrap content of each tab in <a4j:region> , getters of components in tab3 still invoked. please find sample code snippet below: <r:tabpanel id="tabworkingpanel" styleclass="ottmcontainer" selectedtab="#{tabhandlerbean.activetab}"> <rich:tab id="tab1"> <h:commandbutton value="ajaxsubmit"/> </rich:tab> <rich:tab id="tab2" /> <rich:tab id="tab3"> <rich:datatable id="table" value="#{bean.somevalue}">...</rich:datatable> </rich:tab> </r:tabpanel> i think should using rerender relevant tabs refreshed. think should wrap contents of each tab in form not submitted on ea

Displaying updated ntp time in java -

i writing ntp client , server in java. calculating offset , round trip delay using ntp timestamps. should point out calculating these seconds (first 32 bits) , fractions (second 32 bits) separately. getting offset results such 0 seconds , 1859395165 fractions. my question how can use these offsets print out system time if adjusted according given offset? i thinking add fractions onto fractions part of timestamp systems current time, if sum of fractions greater 1 second believe encounter problems seconds incorrect. you convert fraction milliseconds first , calculations. lets time 11:05:21:900 server , offset 200 ms. add 11:05:21:900 , 11:05:22:100. you need function checks if hit new second/minute/etc after adding offset. start of code this. systemms += offsetms; if (systemms >= 1000) { systems += 1; systemms -= 1000; if (systems >= 60) { etc } }

Python embedded in bash not working -

i want embed small python script inside bash script can send json object socket. have tried following code: python -c "$(cat << 'eof' import socket import json data = {'ip':192.168.1.150', 'status':'up'} s = socket.socket(socket.af_inet, socket.sock_stream) s.connect(('127.0.0.1', 13373)) s.send(json.dumps(data)) result = json.loads(s.recv(1024)) print result s.close() eof )" and this: python -c " import socket import json data = {'ip':192.168.1.150', 'status':'up'} s = socket.socket(socket.af_inet, socket.sock_stream) s.connect(('127.0.0.1', 13373)) s.send(json.dumps(data)) result = json.loads(s.recv(1024)) print result s.close() " but keep getting following error: data = {'ip':192.168.1.150', 'status':'up'} ^ syntaxerror: invalid syntax i'm assuming because bash interpreting this, not python. i