Posts

Showing posts from August, 2012

c# - Update Graph (chart control) on another form -

i have c# windows form application contains mainform , graphview form . main form continuously receive current , temperature values usb port , stored in structure array list<> . during these process when click button in main form, form (graphview) form chart control open , plot graph , x-axis : time in minute, y-axis : current in ma, y2-axis : temperature in °c, what can do? in mainform public struct record { public byte chanelnumber; public uint16 serialnumber; public byte samplenumber; public string chanelvoltage; public string chanelcurrent; public string channeltemparature; } list<record>[] channelrecords = new list<record>[12]; channelrecords store received data usb port . private void btngraph_click(object sender, eventargs e) { g = new graphview(); g.show(); task task = new task(sendtograph); task.start(); } private void sendtograp

ios - Reloading UITableView on Main Thread does not always work -

i have problem when reload data of uitableview on main queue doesn't reload data of time. reloads data around 3 out of 5 times when launch app streaks of reloading (3 5 launches) , streaks of not-reloading (2 3 launches). i'm testing app on iphone 6 ios 8.4 , xcode 7 beta 4 using swift 2. this code uiviewcontroller holding uitableview, initial screen app after launching. import uikit class tablecontroller: uiviewcontroller, cllocationmanagerdelegate { let rowtitles = ["date", "temp", "humidity", "wind"] var tabledata = [string : string]() override func viewdidload() { self.setuplocationmanager() } func setuplocationmanager() { // setting location manager self.locationmanager.startupdatinglocation() } func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { locationdata.ownlocation = locations.last! self.locationmanage

how to plot data from a csv in matlab -

i have csv file following data structure: p1_1,p2_1,p3_1 p1_2,p2_2,p3_2 p1_3,p2_3,p3_3 and want plot p2 againt p3 in matlab, wrote code: function plotdata dbstop if error filename='c:\\temp\\out100-2.csv'; m=csvread(filename); plot(m(2),m(3)); but plot empty. checked , m has data, way using plot not right. how can fix problem can plot it? m(2) , m(3) 2 scalar values, hence plot single point. you need supply vectors plot , e.g.: plot(m(:,1),m(:,2)) this plots data first , second columns of csv file.

ruby - Can't create variable on base object in 'self.included' hook in Opal -

it's question title says, have included hook in module: def self.included(base) puts 'included' base.extend api end my api requires variables on object exists none of them being created. i've tried: base.variable_name = [] %x|#{base}.variable_name = []| base.instance_variable_set(:@variable_name,[]) base.instance_exec{@variable_name = []} 1-2 inside of base.instance_exec using self instead of base yet none of them work, console complains variable_name= doesn't exist. what.the.hell? how variable exist on base object inside of included hook? in end, had use @variable_name ||= [] inside of function definitions work, don't works. if want know why don't it's because defining object attributes in once places means can find they're defined , change initial value, whereas here have track down change (not hard it's principle). personal preference guess.

javascript - Is it possible to trigger a datasource read of a kendo scrollview when scrolling to the left? -

the datasource in kendo scrollview (with serverpaging) trigger read (with skip & pagesize) when scrolling right. view notice when close end of dataset , update when end of full list not yet reached. is possible trigger same datasource read when scrolling left? datasource not start @ beginning of full list, want update when close beginning of dataset, while not having reached beginning of full list yet.

Run (Cygwin)C generated exe file using in Netbeans java with process -

i have c file called generator.c , using cygwin64 run make , generator.exe gets created bhulku-parvat@dasnadas /cygdrive/c/users/bhulku-parvat/desktop/bloom-filter $ make make: nothing done 'all'. $ ./bloomgenerator.exe test 4 0.0003 'c:\users\bhulku-parvat\desktop' 'c:\users\bhulku-parvat\desktop\rawdata.txt' and when run in cygwin give 5 parameter ,it succesfully runs , generate desired ouput new file in specified loaction following java code public class bloomtest { public static void main(string[] args) { runtime run = runtime.getruntime(); process p; system.out.println("----sart----"); string cmmd[] = new string[3]; try { cmmd[0] = "c:/cygwin64/bin/bash.exe"; cmmd[1] = "-c"; cmmd[2] = "'c:\\users\\bhulku-parvat\\desktop\\bloom-filter\\bloomgenerator.exe' 'testqw', '4', '0.0003', 'c:/users/bhulku-parvat/desktop' ,'c:/use

Java Sockets Game error -

i followed tutorial( https://www.youtube.com/watch?v=xkbyce59y9w ) , has left me error: unable start client java.net.socketexception: connection reset @ java.net.socketinputstream.read(unknown source) @ java.net.socketinputstream.read(unknown source) @ java.net.socketinputstream.read(unknown source) @ java.io.datainputstream.readint(unknown source) @ client.client.init(client.java:39) @ sun.applet.appletpanel.run(unknown source) @ java.lang.thread.run(unknown source) code: client package client; import java.applet.applet; import java.awt.graphics; import java.awt.event.keyevent; import java.awt.event.keylistener; import java.io.datainputstream; import java.io.dataoutputstream; import java.io.ioexception; import java.net.socket; public class client extends applet implements runnable, keylistener { private static final long serialversionuid = 1l; static socket socket; static datainputstream in; static dataoutputstream out;

Postgresql json select from values in second layer of containment of arrays -

i have jsonb column 'data' contains tree json, example: { "libraries":[ { "books":[ { "name":"mybook", "type":"fiction" }, { "name":"yourbook", "type":"comedy" } { "name":"hisbook", "type":"fiction" } ] } ] } i want able index using query selects value indented "book" jsons according type. book names fiction. i able using jsonb_array_elements join query, understand not optimized using gin index. query is select books->'name' data, jsonb_array_elements(data->'libraries') libraries, jsonb_array_elements(libraries->'book

ios - Screenshot of my app shows blank youtube video -

i using youtube cocoapod library embed video in app. playing inline. have requirement take screenshot of app. use following code take screenshot uigraphicsbeginimagecontext(self.view.frame.size); view.layer.renderincontext(uigraphicsgetcurrentcontext()) let image = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext() in generated image, place has youtube video running empty. how can screenshot of video ? cause because, youtube video runs inside iframe in webview ?? here undocumented way this. objc_extern uiimage *_uicreatescreenuiimage(void); // ... - (ibaction)doscreenshotbutton:(id)sender { uiimage *screenimage = _uicreatescreenuiimage(); // screenshot } still looking api-safe alternative.

java - Spark to HCatalog without Spark SQL -

how connect hcatalog spark job without using spark sql. we using cloudera distribution of spark, in don't have support spark sql. is there other way can connect o hcatalog spark job? why not connect hcatalog rest server via webhcat? https://cwiki.apache.org/confluence/display/hive/webhcat that can done without relying upon cloudera spark / sparksql integration.

android - Shape with only one transparent border -

i'm trying figure out how create shape right border transparent: + + + + + + + + + + + + + + + + + + + i know how can that. @ moment have basic shape represents rectangle point i'm not sure if it's possible want: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#07000000" /> <!-- transparent background --> <corners android:topleftradius="10dp" android:bottomleftradius="10dp" /> <stroke android:width="2dp" android:color="@android:color/white" /> </shape> the main idea hide line dont want show. since have no option specify within shape itself, have use layer-list , define negative padding shift rectangle right side out of bounds. better have corners rounded not of them vis

c# - Static Method for user Id Asp.Net -

we using static property within application fetch username siteminder. problem facing though every time access property calling method inside statement fetch user name, username getting shared across users. i.e. if user1 has logged in application gets value user2. can approach should following. cannot use session , there around 100+ screens accessing property. public static string userid { get{ string userid = "admin"; if (configurationmanager.appsettings["siteminderauth"].tostring() == "true") { // collection of available http headers request namevaluecollection coll = httpcontext.current.request.headers; // retrieve userid siteminder header sm_user userid = coll["sm_user"].split('\\')[1]; } else { userid = configurationmanager.appsettings["siteminderauth"].tostring();

Disable a javascript function -

i trying disable javascript function depending on choice of radio button. if radio button set 'yes' function (in field auto populates number of date fields) disabled user free fill field without auto populating other date fields. make sense? cheers aaron use that: $('#your_radio_button_group_id').change(function(){ //use conditional if check radio has been checked if($('#r1').attr("checked")) { //disable/enable elements } }); see jsfiddle example http://jsfiddle.net/n9tbx/

ssrs 2012 - Total and subtotal are not visible in Report Builder -

what usual reason why in microsoft report builder, though inserted expressions total , subtotal, when press run, total , subtotal rows not visible @ all? in advance like alejandro zuleta said, should check visibility property of row. you can doing right click on row , 'line visibility', or checking in properties @ right of screen. i suggest create red border on totals see if row displayed nothing appears.

node.js - multiCapabilities function throwing error in protractor -

i need run tests in chrome,ff , ie. when use following tag in tc3conf.js file execution works fine. capabilities: { 'browsername': 'chrome' }, however when use following tag, protractor throws error. var reporter = require('protractor-html-screenshot-reporter'); var path = require('path'); exports.config = { allscriptstimeout: 99999, seleniumaddress: 'http://localhost:4444/wd/hub', maxsessions: 1, multicapabilities: [{ 'browsername': 'chrome' }, { 'browsername': 'firefox' }], framework: 'jasmine', specs: ['tc_2.js'], onprepare: function() { beforeeach(function() { browser.driver.manage().window().setsize(1280, 1024); }); jasmine.getenv().addreporter(new htmlreporter({ basedirectory: 'd:/testreport3/', doctitle: 'execution details', docname: 'report.html', metadatabuilder: function(

php - Populate the Phone Number field with the dialing code from the selected country -

hi i'd please. i'm having contact form build on bootstrap , part of code i'd focus on <div class="form-group"> <label for="country">* country in ?</label> <select name="country" class="form-control"> // list of countries here - comes database <option value="uk">united kingdom</option> <option value="gre">greece</option> <option value="ger">gemany</option> <option value="fra">france</option> <option value="ita">italy</option> </select> </div> <div class="form-group"> <label for="phone">* what’s phone number ?</label> <input type="text" name="phone" value="" class="form-control" /> </div> what i'd when select country dropdown popu

wpf - How to share vector icon while being able to change Fill brush -

in .net 4.6, use shared vector icons implemented path in canvas in global xaml this: <resourcedictionary ...> <canvas x:key="msearchcanvas" x:shared="false" width="24" height="24"> <path data="m9.5,3a6.5,6.5 0 0,1 16,9.5..." fill="black" /> </canvas> </resourcedictionary i can reuse these icons in several applications using: <viewbox width="16" height="16" child="{staticresource mpencilcanvas}"/> it works i'd use same icon/canvas different fill brushes. is there simple way override fill property new value?

java - XPath selector Selenium WebDriver, unable to use ID -

selenium ide exported java/junit driver.findelement(by.cssselector(".x-btn-inner:contains('yes')")) .click(); and doesn't work because contains doesn't exist in css. want pass xpath driver.findelement(by.xpath("//.x-btn-inner[contains(., 'yes']")).click(); this code isn't working, doing wrong? <span id="button-1006-btnel" data-ref="btnel" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-small x-btn-text x-btn-button-center "><span id="button-1006-btniconel" data-ref="btniconel" role="presentation" unselectable="on" class="x-btn-icon-el x-btn-icon-el-default-small " style=""></span><span id="button-1006-btninnerel" data-ref="btninnerel" unselectable="on" class="x-btn-inner x-btn-inner-default-small">ye

Cannot explicitly refer to controls on a report (MS Access/VBA) -

how refer report's controls explicitly? referring implicitly works expected: me.lbltest.visible = true however, of attempts @ referencing control explicitly meet various nonsensical runtime errors. access' favorite: "the report name 'rpttest' entered misspelled (it's not) or refers report isn't open (it is) or doesn't exist (it does) ." i've tried dozen syntax variations msdn , everywhere else find, producing errors: reports!rpttest.lbltest.visible = true ' ^--expected syntax, forms!frmname.ctlname.property reports!("rpttest").lbltest.visible = true reports![rpttest].lbltest.visible = true reports("rpttest").controls("lbltest").visible = true etc. etc. this should no different referring forms' controls, right? there must way refer explicitly report's controls. check names of reports access thinks open. with report open, go immediate window. ctrl + g take there.

c# - how to check all items in my RadListBox -

aspx.cs: radlistdirectiondetail.datasource = m_listedirection; radlistdirectiondetail.datavaluefield = "departmentid"; radlistdirectiondetail.datatextfield = "departmentname"; radlistdirectiondetail.databind(); if (radlistdirectiondetail.items.count > 0) { (int = 0; < radlistdirectiondetail.items.count; i++) { radlistdirectiondetail.items[i].checked = false; } } aspx: <telerik:radajaxpanel runat="server" id="radajaxpanel2"> <telerik:radlistbox id="radlistdirectiondetail" runat="server" checkboxes="true" width="200px" showcheckall = "true" selectionmode="multiple" autopostback="true" height="55px" skin="outlook" visible="false" enabled="false"> </telerik:radlistbox> </telerik:radajaxpanel> i think prob

how to detect computer vision blob of pixels within specific color range, using Matlab? -

what matlab computer vision functions detect, in single video frame, blob (mostly) of pixels within specific color range? i want detect stationary objects, , looking non-movement function can detect blobs each frame. for example, if want detect red object, apple of specific color, sitting on table. i'm trying vision.blobanalysis() i'm not sure if works moving blobs. matlab not clear on this.

Inno-Setup: detect /SUPPRESSMSGBOXES to not show MsgBox in Code -

we using inno-setup pascal scripting. depending on system, yes-no-messagebox shown. how can detect /suppressmsgboxes switch not show messagebox? use built in suppressiblemsgbox function ( http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_suppressiblemsgbox ).

c# - Add/remove EventHandler for UIBarButtonItem -

one can define eventhandler in constructor: uibarbuttonitem logoutbutton = new uibarbuttonitem (uibarbuttonsystemitem.stop, logoutbuttoneventhandler); private void logoutbuttoneventhandler(object sender, eventargs args){ console.writeline("logout"); } is possible remove eventhandler afterwards? perhaps not using eventhandler @ , instead use action / target properties of uibarbuttonitem ? don't find examples. anonymous methods used time. how do that? instantiate object , set handler: var logoutbutton = new uibarbuttonitem (uibarbuttonsystemitem.stop) logoutbutton.clicked += logoutbuttoneventhandler; to remove afterwards use -= syntax: logoutbutton.clicked -= logoutbuttoneventhandler; just beware of commom pitfalls when because may cause memory leaks.

server - pros and cons of using serialization with java nio versus old socket programming model -

i want choose between using old socket programming model (one thread per socket) , new socket programming model uses java.nio. when read article non blocking socket architecture, noticed architecture based on serialization of requests coming clients. according article, client applications simultaneously perform requests server. selector collects them, creates keys, , sends them server. article confused me, since serialization cannot support scalabity of servers. if have 10000 of clients connected server, there should delay process sub-requests of clients. on other side, read way scale server 1000 of clients using java.nio. here article: http://archive.oreilly.com/pub/a/onjava/2002/09/04/nio.html?page=2 so article confused me, since serialization cannot support scalabity of servers. if have 10000 of clients connected server, there should delay process sub-requests of clients. when there i/o process nio thread run @ full speed, processing data fast physically ab

Android: Update text in notification without resetting animation -

i'm trying implement notification music app. it's comprised of play/pause , next buttons, , textview marquee enabled song title scrolls. when try change play/pause buttons icon, marquee text resets. here's notification layout file: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <imagebutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:src="@drawable/perm_group_audio_settings" android:id="@+id/album_art" android:background="#00000000" /> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:lay

purpose of .RDataTmp temporary file? [R] -

what purpose of r temporary file created in every directory workspace saved? data contain , safe delete? that file holding file save.image() while r waits file argument succeed. help(save.image) , safe argument - safe - logical. if true, temporary file used creating saved workspace. temporary file renamed file if save succeeds. preserves existing workspace file if save fails, @ cost of using disk space during save. so file contains entire workspace image , best leave there in case r fails save workspace normally. i'm guessing if see file, r has failed rename file may want search file , check contents before deleting temporary file.

javascript - Display collection length in a view in Marionette.js -

i'm learning marionette.js , have scenario, app has: app.addregions({ main: '#omen', newitem: '#addnewitem', counter: '#counter' }); these regions. have these model/collections: var item = backbone.model.extend(), items = backbone.collection.extend({ model: item, url: 'api/items' }), i have item view , items view: itemview = mn.itemview.extend({ tagname: 'tr', template: '#itemview', events: { 'click #btndeletebook' : 'deleteitem' }, deleteitem: function() { app.trigger('item:delete', this.model); } }), itemsview = mn.collectionview.extend({ tagname: 'table', childview: itemview, onshow: function(view) { tweenmax.staggerfrom($(view).find('td'), 1, { x: 100 }, 2); } }), i have initializer function, listens events above , stuff through app.itemcontroller. works fine. but want ad

asp.net - Conditional Web.config depending on parent Web.config -

in app there 1 web.config in root folder , 1 in folder below. depending on content of root web.config i'd sub-web.config apply different settings, i.e.: root web.config says: "we're in mode a." -> subfolder web.config applies various settings (e.g. appsettings , system.web elements) "mode a". and there "mode b" , "mode c". is somehow possible? in case web.config transforms not suitable, neither application-level logic (due how asp.net works need activate , de-active parts of subfolder web.config).

ios - Issue with NSURLSession with multiple downloads in background with multiple sessions and multiple segments -

we have crated session below configuration code. call method each task crate. +(nsurlsession ) getnewsessionwithid:(nsstring )sessionid delegateobject:(id)sender { nsurlsession *session; nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration backgroundsessionconfigurationwithidentifier:sessionid]; nsoperationqueue *queue=[[nsoperationqueue alloc]init]; queue.maxconcurrentoperationcount=10; queue.name=sessionid; session = [nsurlsession sessionwithconfiguration:configuration delegate:sender delegatequeue:queue]; nslog(@"session id :%@",session); nslog(@"queue : %@",queue); return session; } even multiple sessions created multiple tasks 1 session active , 1 task executing , task 3 part downloading 1 session. this method called create , start download task. -(void)dlrequestallrenge:(nsmutablearray*)arrayrange andfileinfo:(fileinfo *)fileinfoobj { nsmutablearray *arrayallparts=[[nsmutablearray alloc]ini

javascript - jQuery keeps adding <li> tags to the dom -

consider following code: $('#calendar-dates').on('click', 'td', function() { retrieve_availability(date, function(data) { //ajax callback $appointments = data; window.appointments = $appointments; $(".appointments").hide().fadein(); timetable(); range($appointments); }); } $('.appointments').on('click', 'li', function() { //do $(".confirm").unbind().bind('click', function() { //do } } and html structure <div class="appointments"> <ul class="appointment_list"> // <li> tags appended dynamically </ul> <div class="actions"> <a href="#" class="confirm">apply</a> <a href="#" class="close">cancel</a> </div> </div> what want when, user clicks confirm button, close whole app

extjs - Deploy same Javascript webapp build to different environments -

i have extjs application , different environments (local machine, development, production-like test environment, , production). extjs application backed java backend running on either local machine, in development environment, production-like test environment or production environment (not same servers front end application lives though). for last 2 environments, want build 1 build of extjs app , first deploy test server, when ready release deploy exact same build production server. question: possible somehow use environment frontend deployed, decide backend extjs should connect to? since extjs front-end executed on client's machine, doesn't know if should connect production backend or test backend. what best way solve problem this? how (in clean way) javascript web application built , deployed several different environments , communicates corresponding backend application? how (in clean way) javascript web application built , deployed several different

jQuery $('#submitForm').find('form') vs jQuery $('#submitForm form') -

i wondering of both methods faster: selecting container , form @ in 1 statement: jquery $('#submitform form') or using jquery's .find() selector: jquery $('#submitform').find('form') the .find() approach faster because first selection handled without going through sizzle selector engine – id-only selections handled using document.getelementbyid( ), extremely fast because native browser. so jquery $('#submitform').find('form') is faster than jquery $('#submitform form') selector optimization less important used be, more browsers implement document.queryselectorall() , burden of selection shifts jquery browser.

ruby on rails - ActiveAdmin page not displaying form_tag form alongside other content -

i have activeadmin page want use upload variety of files various controllers: activeadmin.register_page "import" content columns column panel "overview" para "this admin import page." end end column panel "update/import matters" para "this info form should take." form_tag import_matters_path, multipart: true file_field_tag :file submit_tag "import" end end end end end end the page displays, right hand column displays panel text "this info..." when comment out line, import button no way upload file. when comment out submit_tag , para line, 'choose file' button select file import, nothing else. the panel seems unable concatenate html form p

vba - Excel macro to open a folder of excel workbooks and copy 1 cell -

i have folder of .xlsx files, each identical in layout. i need write macro in excel open each file in turn (100+ files) data (a name) single cell, , drop in new excel worksheet, move on next , insert below last 1 etc. giving me list of names data not file names) here (pretty much) you're trying do. next time little bit of googling before ask! :) http://www.excel-easy.com/vba/examples/files-in-a-directory.html rough code unsure if work: here basic idea of need modify in example sent you. if @ example again, need , some. since weren't interested in worksheets, don't have loop through worksheets in workbook. can open up, read cell of interest, , close it. while loop every excel file in directory. again! please modify example accordingly before use it. dim directory string, filename string, sheet worksheet, integer, j integer application.screenupdating = false directory = "c:\test\" filename = dir(directory & "*.xl??") while fi

asp.net mvc - How to host mvc5 project with Database on Godaddy server -

i have 3 projects (mvc5 web, database , db first ef) in 1 solution. can host mvc5 simple app (not including database) in godaddy server. i'm able create db in godaddy server (i.e. creating scripts in local sql server ms in pc , pasing in godaddy sql server. working fine.) , got connection string. question is, 1- should host "db first ef" ? if yes how ? 2- suppose want change db, how modify edmx file in server? (like in visual studio when ever modify db object, can change our edmx manually.) suggestion appreciate. in advance.

ibm - Websphere MQ Cluster Workload Balancing: messages going to dead letter queue -

i have created wmq cluster 3 qmgrs. 2 full repository , 1 partial repository. here mqsc used: crtmqm gw strmqm gw runmqsc gw alter qmgr deadq('system.dead.letter.queue') define listener(gw.listener) trptype(tcp) port(1416) ipaddr(xx.xx.xx.xx) start listener(gw.listener) define channel(system.admin.svrconn) chltype(svrconn) alter qmgr chlauth(disabled) end runmqsc qm01 alter qmgr repos('development.cluster') end runmqsc qm02 alter qmgr repos('development.cluster') end runmqsc qm01 define chl(to.qm01) chltype(clusrcvr) trptype(tcp) + conname('xx.xx.xx.xx(1414)') cluster(development.cluster) end runmqsc qm02 define chl(to.qm02) chltype(clusrcvr) trptype(tcp) + conname('xx.xx.xx.xx(1415)') cluster(development.cluster) end runmqsc gw define chl(to.gw) chltype(clusrcvr) trptype(tcp) + conname('xx.xx.xx.xx(1416)') cluster(development.cluster) end runmqsc qm01 define channel(to.qm02) chltype(clussdr) trptype(t

python - Calculate no of whole weeks for a given dates -

from datetime import datetime def calculate_whole_week(year, start_month, end_month, weekday): date_str_start = str(year)+' ' + start_month+' '+ weekday date_str_end = str(year)+' ' + end_month+' '+ weekday start_day = datetime.strptime(date_str_start, '%y %b %a') end_day = datetime.strptime(date_str_end, '%y %b %a') no_of_whole_weeks = (end_day - start_day).days//7 -1 return no_of_whole_weeks calculate_whole_week(2014,'april','may','wednesday') i tried following unable compile it start_week_day = time.strptime(str(y)+' '+ + ' '+ w,"%y %b %a").tm_wday end_week_day = time.strptime(str(y)+' '+ b + ' '+ w,"%y %b %a").tm_wday start_dt = time.strptime(str(y)+' '+a+' '+ str(start_week_day),'%y %b %d') end_dt = time.strptime(str(y)+' '+ b +' '+ str(end_week_day),'%y %b %d') no_of_who

javascript - using Ajax to send information to classic ASP -

i'm new please bare me. i have reset button on html table. when clicked, gets information related row, particularly 'record id' , 'active'. i'm trying take record id number , send asp page called resetinbound.asp this first time using ajax i'm not sure if i'm doing correct here code on click: $(function(){ $('button').on('click', function(){ var tr = $(this).closest('tr'); var recid = tr.find('.recid').text(); var active = tr.find('.active').text(); alert('id: '+recid+', active: ' + active); $.ajax({ type: "post", url: "resetinbound.asp", data: recid, success: function() { alert("i after sending data sucessfully server.");} }); // ajax call ends }); }); the asp file code: dim recid recid = request.querystring("recid") i tried request.fo

python - Print list while excluding specific named values -

i looking basic way exclude printing item list (not remove/delete) if named value = specified, e.g. = 0 i thought basic this, error not defined. a = 2 b = 0 c = 4 d = 0 e = 6 lis = [a,b,c,d,e] while != 0 in range(lis): print (lis[i]) wanted result: 2 4 6 seems missing simple? or not simple imagined? python syntax doesn't support conditional you're trying apply it. there several alternatives, though: you put condition inside loop: for item in lis: if item != 0: print item you filter list: for item in filter(lambda i: i!=0, lis): # filter(none, lis) works print item or using list comprehension (technically generator expression here): for item in (i in lis if != 0): print item or skip loop entirely: print '\n'.join(str(i) in lis if != 0)

Rails application not found? -

i returned first hello world rails program hartyl tutorial , tried run application had worked , displayed 'hello world'. time doesn't run , when go share , try open url, says couldn't find application. any ideas why happen? tried run rails server command scratch , went on instructions hasn't solved it. would appreciate , patience, thanks. *wish give more info. first program i've done in rails , first time i've returned program after mini hiatus in rails expected run did before when returned cloud9 ide tutorial uses. in general, should run did before, or normal have start in terminal again see running in url?

python - Subtracting the Nearest Prime Given Two Lists using for loop and max -

i have 2 lists: (1) of primes (prime_list), , (2) of odd numbers (odd_list). find highest prime under each odd number, having difficultly. example, odd number 99 want subtract 97. i have been trying use "for loop" , max. concept can grasp. sure there other method, have been more confused. see example: how find nearest prime number in array, number in array? def max_prime(): each_odd in odd_list: print(max(prime_list)) if add ( how can clean? possible using max , loop? you can bisect once prime list in sorted order, subtract 1 index returned , prime list: from bisect import bisect_left odd_list = range(3, 50, 2) primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71] each_odd in odd_list: ind = bisect_left(primes, each_odd) print(each_odd, primes[ind - 1]) output: (3, 2) (5, 3) (7, 5) (9, 7) (11, 7) (13, 11) (15, 13) (17, 13) (19, 17) (21, 19) (23, 19) (25, 23) (27, 23) (29

paste - R: collapse a vector by two elements -

i have vector, e.g. sdata = c('a', 'b', 'c', 'd') . sdata [1] "a" "b" "c" "d" how can collapse 2 (or more if needed) elements following output? desiredoutput [1] "a b" "b c" "c d" thanks! edit: real sample data: sdata = list(c("salmon", "flt", "atl", "farm", "wild", "per", "lb", "or", "fam", "pk"), c("vit", "min", "adult", "eye", "visit", "our", "pharmacy", "we", "accept", "express", "script", "offer", "val", "mathing", "pricing", "fast", "conv", "service"), c("ct", "gal", "or", "drawstring", "odor", "shield", "twist", &q

c++ - VC++ create Cdialog Class Assertion error -

i'm complete noob visual studio, it's stupid mistake. i'm trying instantiate cdialog class, i'm making dll in end need had activex commands in window. i'm tried several ways instantiate, getting assertion error. so in calldllclass.h had: #pragma once __declspec(dllexport) long init(); in class extend cdialog: //{{afx_includes() //}}afx_includes class cmyclass: public cdialog{ #include "resource.h" public: cmyclass(cwnd* pparent = null) : cdialog(100, pparent){ //{{afx_data_init(cmyclass) //}}afx_data_init }; // standard constructor virtual ~cmyclass(){}; long calc(); // dialog data //{{afx_data(cmyclass) //}}afx_data // classwizard generated virtual function overrides //{{afx_virtual(cmyclass) protected: //}}afx_virtual protected: // generated message map functions //{{afx_msg(cmyclass) //}}afx_msg declare_message_map() }; //{{afx_insert_location}} i

Google Analytics counting sessions/views twice? -

a site work saw doubling of it's direct traffic recorded in google analytics. there doesn't seem obvious external reason increase (like promotion or something) i'm looking possible technical reason. when loading homepage , monitoring real time traffic sources, see 2 hits in rapid succession each time reload page. however i'm using ga debugger extension in chrome , it's showing 2 expected function calls: ga('create') , ga('send', 'pageview'). the site has other event tracking set each event wrapped in event listener in js aren't firing automatically. , if should show in ga debugger anyway so i'm @ loss. can't think of why happening, let alone direct traffic opposed other sources. have ideas? thanks!

ruby - How to write to a JSON file in the correct format -

i creating hash in ruby , want write json file, in correct format. here code: temphash = { "key_a" => "val_a", "key_b" => "val_b" } fjson = file.open("public/temp.json","w") fjson.write(temphash) fjson.close and here contents of resulting file: key_aval_akey_bval_b i'm using sinatra (don't know version) , ruby v 1.8.7. how can write file in correct json format? require json library, , use to_json . require 'json' temphash = { "key_a" => "val_a", "key_b" => "val_b" } file.open("public/temp.json","w") |f| f.write(temphash.to_json) end your temp.json file looks like: {"key_a":"val_a","key_b":"val_b"}

Display LaTeX equations in a shiny dashboard app in R -

Image
i display rmd file latex equations in shiny dashboard app. i've run problems using includemarkdown() , includehtml() . here simplified app of i'm trying achieve. here app.r: library(shinydashboard) ui <- dashboardpage( dashboardheader(title='my test application'), dashboardsidebar( sidebarmenu( menuitem("theory", tabname = "theory", icon = icon("book")) ) ), dashboardbody( tabitems( tabitem(tabname="theory", includemarkdown("theory.rmd") #includemarkdown("theory.md") #includehtml("theory.html") ) ) ) ) server <- function(input, output){ } shinyapp(ui = ui, server = server) my theory.rmd file: --- title: "theory" output: html_document: mathjax: "http://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-ams-m

asp.net - How to load a unmanaged dll into a seperate process for each request -

in our asp.net application, load unmanaged dll (written in delphi) using tag dllimport . dll generates pdf file using different parameters. the problem if 2 users try generate pdf @ same time, different errors since progress can take seconds. is there way load dll in separate process each user request? or have handle in dll?

javascript - Backbone template loading using promises -

similar this question , i'm looking way load templates via javascript promises. issue i'm running returning compiled template backbone view. note: this.getfile() returns new promise , fetches template expected. template: function(attributes) { this.getfile('/path/to/template').then(function(tpl) { var compiled = handlebars.compile(tpl); return compiled(attributes); }, function(error) { console.error('failed!', error); }); } within view's initialize , have listener set to initialize: function() { this.model.on('change', this.render, this); } which triggers expected when data fetched server. the problem when render function executes line render: function() { ... this.$el.html(this.template(attributes)); ... } nothing renders html expect. i'm sure i'm missing simple within template promise callback, no matter change, html not render , no errors appear. like @muistooshort have pointed out. tem

javascript - Calculate how many Array in the JSON -

i working on simple angularjs project, , have code: this view: <tr ng-repeat="metering in meterings"> <td>1</td> <td>{{metering.d.serialnumber}}</td> </tr> this controller: angular.module('mainctrl', []).controller('maincontroller', function($scope,$http,nerds) { nerds.get() .success(function(data){ $scope.meterings = data; }); }); this services: angular.module('nerdservice', []).factory('nerds', ['$http', function($http) { return{ : function(){ return $http.get('http://amrse.net/list.json'); //let's pretend path works fine } } }]); my questions are: 1. how can number 1 in table (in view) changes dynamically? <td>1</td> i want calculate total array repeat in <td>{{metering.d.serialnumber}}</td> . like: total : {{ metering.gettot

concat Javascript objects with more than one key -

is there possibility way easy concat javascript arrays? here code , works, if nonperiodicallyschedulesobject has 1 key var mergedobjects = schedulesobject[schedulesobjectkey].concat(nonperiodicallyschedulesobject[nonperiodicallyschedulesobjectkey]); currently have usecase nonperiodicallyschedulesobject contains more 1 key: ['13', '3453'] is there easy , performant way concat schedulesobject[schedulesobjectkey] , nonperiodicallyschedulesobject 1 or more 1 key? thanks lot!

c# - Mono.Cecil auto-implemented property accessing backing field -

i using mono.cecil inject il code in auto-implemented property setter. problem is, can reference typedefinition.fields object when inject ldfld instruction (after ldarg.0 instruction ofc) reference causes application break, , clr invalid program detected exception raised. tried decompile ilspy , got exception mono.cecil argument out of range exepction in get_item(int32) method . it's trying access backing field before it's created compiler, somehow mono.cecil can see when loads assembly. public class iltesting { public int counter { get; set; } } this how setter looks before injection: il_0000: ldarg.0 il_0001: ldarg.1 il_0002: stfld int32 syringewpftest.iltesting::'<counter>k__backingfield' il_0007: ret here injection code: var fieldname = "<" + property.name + ">k__backingfield"; var fieldref = iltesttype.fields.single(field => field.name == fieldname); var setterinstruction = property.setmethod.body.instru

python - Windows docker-machine adding ssh.exe to PATH -

according docker-machine documentation installation on windows, need run following command add ssh.exe %path% environment variable: set path=%path%;"c:\program files (x86)\git\bin" this cmd.exe can recognize docker-machine command. however, running above command doesn't seem @ all. same thing happens when try in powershell: $env:path = "${env:path};c:\program files (x86)\git\bin" which say, apparently nothing @ all. goal make docker-machine recognizable command in cmd.exe . because have python script set docker-machine vm , script needs able run in cmd.exe . how can done? it's important not go advanced system settings computer , modify environment variables way, since requires admin privileges , setup needs work without sort of admin privileges. it's important not go advanced system settings computer , modify environment variables way, since requires admin privileges , setup needs work without sort of admin privileges.