Posts

Showing posts from September, 2015

objective c - Deep Linking for iOS Apps which are not installed yet? -

i want use deep linking specific place in app using lib like: https://github.com/usebutton/ios-deeplink-sdk i know how make deep linking when app installed on device. how can deep link app not installed on device, i.e., link refers appstore , after installing app deep link token should present? you use uiapplications canopenurl method check if app exists. see example: -(void)openotherapp { uiapplication * myapplication = uiapplication.sharedapplication; nsstring * urlencodedstring = [@"somesortofaction" stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsstring * completepath = [@"otherappsurlscheme://" stringbyappendingstring:urlencodedstring]; nsurl * theurl = [nsurl urlwithstring:completepath]; if ([myapplication canopenurl:theurl]) { // app installed, launch [myapplication openurl:theurl]; } else { // app not installed open app store // replace appstore web ur

ios - Reload Table view cell with animation (Swift) -

is there way reload specific uitableview cells multiple sections animations? i've been using: self.thetableview.reloadsections(nsindexset(index: 1), withrowanimation: uitableviewrowanimation.right) this animates cells in section though. other option use: self.thetableview.reloadrowsatindexpaths(<#indexpaths: [anyobject]#>, withrowanimation: <#uitableviewrowanimation#>) edit: after using reloadrowsatindexpaths terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 1. number of rows contained in existing section after update (5) must equal number of rows contained in section before update (4), plus or minus number of rows inserted or deleted section (0 inserted, 0 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out).' trying find smooth way of reloading tableview appending objec

How to copy data from an excel sheet to another excel sheet uploaded in sharepoint using VBA? -

i ask if it's possible copy or transfer data excel sheet worksheet uploaded in sharepoint without need of opening file sharepoint. done vba? you're prompt response appreciated. lot! if have access sharepoint can use code: excel vba up-/download multiple sharepoint folders in order open sharepoint folders network drive , access files using filesystemobject or dir on local hard disk. i recommend method if you've enough drive letters available. 1 letter 1 folder. can connect root folder on sharepoint , browse subfolders in explorer. i hope you. if have question, ask.

c++ - Error while parsing xml file in cpp using Rapidxml -

i trying read , xml file , parsing using below code can suggest mistake making. it shows error error: (e549) uncaught exception: configexception: expected < void parsercnffile::read(void) { ifstream file(m_file.m_name.c_str(), ios::in | ios::binary | ios::ate); if (file.is_open()) { file.seekg(0, ios::end); int size = file.tellg(); m_file.m_contents = new char[size]; file.seekg(0, ios::beg); file.read(m_file.m_contents, size); file.close(); } else { throw configexception("configexpection: not open \"" + m_file.m_name + "\""); } } void parsercnffile::parse(void) { xml_document<> doc; // character type defaults char try { doc.parse<0>(m_file.m_contents); flags } catch (rapidxml::parse_error& e) { cout << m_file.m_contents << endl; throw configexception(string() + "

python - Pandas, groupby where column value is greater than x -

i have table this timestamp avg_hr hr_quality avg_rr rr_quality activity sleep_summary_id 1422404668 66 229 0 0 13 78 1422404670 64 223 0 0 20 78 1422404672 64 216 0 0 11 78 1422404674 66 198 0 40 9 78 1422404676 65 184 0 30 3 78 1422404678 64 173 0 10 17 78 1422404680 66 199 0 20 118 78 i'm trying group data timestamp , sleep id , rr_quality , rr_quality > 0 i've tried following , none of them seems work df3 = df2.groupby([df2.index.hour,'sleep_summary_id',df2['rr_quality']>0]) df3 = df2.groupby([df2.index.hour,'sleep_summary_id','rr_quality'>0]) df3 = df2.

c++ - Why doesn't this program run properly under Clang or GCC? -

i'm trying run cppreference's regex_search example : #include <iostream> #include <string> #include <regex> int main() { std::string lines[] = {"roses #ff0000", "violets #0000ff", "all of base belong you"}; std::regex color_regex("#([a-f0-9]{2})" "([a-f0-9]{2})" "([a-f0-9]{2})"); (const auto &line : lines) { std::cout << line << ": " << std::regex_search(line, color_regex) << '\n'; } std::smatch color_match; (const auto &line : lines) { std::regex_search(line, color_match, color_regex); std::cout << "matches '" << line << "'\n"; (size_t = 0; < color_match.size(); ++i) std::cout << << ": &q

javascript - How to center a scrollable image that is larger than the screen -

i'd make image viewer centers image regardless of how big , allows scrolling view entire image. the problem i'm running that, while centering images smaller container easy, when they're larger tranform i'm doing positions image off right , top of screen. here fiddle has fixup javascript make work: http://jsfiddle.net/d3y0b8bd/ the code below work smaller images (e.g. https://upload.wikimedia.org/wikipedia/meta/0/08/wikipedia-logo-v2_1x.png ) but larger, translate(-50%, -50%) transform translate image past left , top margins of parent. .lightboxroot { position: fixed; width: 100%; height: 100%; overflow: auto; /*aesthetic*/ background-color: red; } .lightboximg { position: absolute; top: 50%; left: 50%; margin-right: -50%; transform: translate(-50%, -50%); /*aesthetic*/ background-color: blue; } html: <div class="lightboxroot"> <div class="lightboximg"> <i

javascript - SignalR sharing connection between 2 apps -

i have 2 projects in solution, 1 mvc app , second 1 simple windows forms app. i'm trying do, testing purposes, control content on mvc app through windows forms app. simplify further, have button on app, should, when clicked, update html on connected clients. mvc should manage client connections, , forms app should dedicated content administration. what did - mvc hub setup public class connectionhub : hub { public void update() { clients.all.updatesequence(" "); } } mvc startup setup: [assembly: owinstartup(typeof(web.startup))] namespace web { public class startup { public void configuration(iappbuilder app) { globalhost.dependencyresolver.usesqlserver( configurationmanager.connectionstrings["signalr"].connectionstring); app.mapsignalr(); } } } forms app - on button clicked event: private void button1_click(object sender, eventargs e) { var co

excel - INDEX MATCH using "configuration" strings in separate cells -

my attempt use value in particular cell configure index argument has not been panning out point. i have attempted create configuration sheet define index ranges used throughout working data sheet formula this: index(config!r1c2,match(rc1,config!r1c3,0),config!r1c4) in config!r1c2 cell example i'd put rawdata!r1c1:r100000c100 index range, in config!r1c3 i'd define match lookup range rawdata!r1c5:r100000c5 . this attempt @ allowing me populate report using index match, while avoiding having reconfiguring every formula each time raw data's format changes (which changes , have 0 control over). configuration sheet i'd able redefine index range, , match range in 1 cell. in formula need wrap cell reference indirect() function in order evaluate contents of cell config!r1c2 range. indirect volatile, though , may slow down workbook. consider using named formulas (named ranges) instead. create 3 range names (formula ribbon > name manager > new ).

osx - NSVisualEffectView with Tab View Controller using storyboard -

im using storyboard in app , tabviewcontroller 3 tabs. when put nsvisualeffectview in views works fine, when move window, visualeffectview starting disappear. settings visual effects are: behind window, dark active. use ib put them in views. if use 1 view without tabviewcontroller nsvisualeffectview works fine, tabviewcontroller cause troubles. can please help?

vbscript - Inserting Lines into a Non-Text File -

i trying insert lines middle of non-text file (the extension of file "dxf"). using vbscript this. everywhere have look, come across filesystemobject.opentextfile. however, when try use on dxf file, causing error: exception 80070057 (i believe invalid file) . here code: dim file dim fso set fso = createobject("scripting.filesystemobject") if fileexists(dxffile$) set file = fso.opentextfile(dxfpath, forappending, true) file.writeline("<portlist testing>asdflkj") file.close end if dxffile$ not valid vbscript variable name; use dxffile , file or dfxpath (consistently) fileexists method of filesystemobject; need call fso.fileexists neither dxffile , nor dfxpath , nor forappending defined calling .opentextfile undefined/empty first/filespec parameter throws error 5 - invalid procedure call or argument you can't insert lines appending them; modifying files 'in middle' clumsy in vbscript; loading who

sql server - SQL Case statement returns wrong value -

i have following sql statement designed give field t1.dwposteddatekey value if t2.inventorystatuscode changes 'p'. starting value of t1.dwposteddatekey null, , if t2.inventorystatuscode doesn't change, want stay null. select t1.datekey, t1.dwposteddatekey, (case when t2.inventorystatuscode = 'p' , (t1.inventorystatuskey != t2.inventorystatuskey) convert(int, getdate(), 112) else t1.dwposteddatekey end) table1 t1 inner join table2 t2 on t1.key = t2.key the problem don't null ? here example of results: datekey dwposteddatekey (no column name) 20150413 null 42106 20150413 null 42106 20150413 null 42106 20150413 20150414 20150414 20150413 20150414 20150414 20150413 20150414 20150414 what 42106 doing in there? want remain null value. the problem line convert(int, getdate(), 112) , in int . it converting datetime int , sql

How to show/draw the spectrum frequency from line into bar shape (android)? -

i learning how make spectrum analyzer. learn tutorial , here's code package com.example.prasetyo.spectrumanalyzer; import android.app.activity; import android.graphics.bitmap; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.media.audioformat; import android.media.audiorecord; import android.media.mediarecorder; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imageview; import ca.uol.aig.fftpack.realdoublefft; /*public class spectrumactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_spectrum); }*/ public class spectrumactivity extends activity implements onclicklistener { public void onclick(view v) { if (

css - CORS policy for S3 bucket referencing itself -

in css files have relative paths: .css-emoticon.smile{ background: url('../../images/sprites.png'); background-position: -16px -18px ; } but forbidden 403 error sprite.png file when pulling s3 load on site. css file loads fine s3 onto site. my s3 located on subdomain: http://media.example.com , site loads in files s3 http://example.com here cors file: <?xml version="1.0" encoding="utf-8"?> <corsconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <corsrule> <allowedorigin>*</allowedorigin> <allowedmethod>get</allowedmethod> <maxageseconds>3000</maxageseconds> <allowedheader>content-*</allowedheader> <allowedheader>host</allowedheader> </corsrule> </corsconfiguration> any ideas on how set cors policy allow relative urls in css? thanks much looks didn't set bu

python - PYMC MAP Fit problems -

i use pymc implement multinomial-dirichlet pair. want map model instances have. issue face once map.fit() prior distribution changed. thus, every new instance, need have new prior distribution, should fine. however, keep seeing error: traceback (most recent call last): file "/users/xingweiy/project/starrating/timeplot/bayesianprediction/diricheletmultinomialstarrating.py", line 41, in <module> prediction = predict.predict(input,prior) file "/users/xingweiy/project/starrating/timeplot/bayesianprediction/predict.py", line 12, in predict likelihood = pm.categorical('rating',prior,value = exp_data,observed = true) file "/library/python/2.7/site-packages/pymc-2.3.4-py2.7-macosx-10.9-intel.egg/pymc/distributions.py", line 3170, in __init__ verbose=verbose, **kwds) file "/library/python/2.7/site-packages/pymc-2.3.4-py2.7-macosx-10.9-intel.egg/pymc/pymcobjects.py", line 772, in __init__ if not isinstance(self.

javascript - How to override default functionality in Ember-addons -

in ember-cli documentation describes bridging addon within host application overriding app/component/[addon-name.js] yourself. however, documentation doesn't explicitly state how this. with trial , error i've noticed creating component file in [host app]/app/component/[name of addon.js] , copy/paste addon code there provides venue customize addon. however, terrible approach, imagine override functions in question...and in cases call this.super().functionname in order keep over-rides simple , trim. however, can't work. ideas? extensibility why addons have both addon/ , app/ trees. in app tree component, component should import , export, example: import xselect 'emberx-select/components/x-select'; export default xselect; source: https://github.com/thefrontside/emberx-select/blob/master/app/components/x-select.js in kind of case want create component in [host app]/app/component/[name-of-addons-component.js] in component do: import xselect

security - Writing a buffer overflow exploit -

i understand there quite few tutorials on how write buffer overflow, still can't write own. the following c code want hack: #include <stdio.h> #include <stdlib.h> static int x = 8; void prompt(){ char buf[100]; gets(buf); printf("you entered: %s\n", buf); } int main(){ prompt(); return 0; } void target(){ printf("haha! made it!\n"); exit(0); } my goal execute target () function via buffer overflow exploit. through trial , error, i've discovered minimum number of characters required obtain segmentation fault 108. (therefore 107 characters not cause seg fault) i've disassembled binary, , found target executable @ address 0x08048e7f i've flipped byte order compensate endian-ness. --> 0x7f8e0408 converted hexadecimal binary, ascii, obtaining: & # 3 8 1 ; (ignore spaces, stackoverflow doesn't show originally) afterwards, inserted first 107 characters, , Ž thus, attack string is: iii

r - Errors in tsoutliers: non-finite value supplied by optim -

my objective remove outliers time series, forecast adjusted series. should happen automatically using tso() function in tsoutliers package. however, receiving errors appear related xreg produced automatic outlier detection. can please explain errors , advise how avoid them when using tso() function. in both examples 1 data point appears cause error. library(tsoutliers) <- c(0.0006803534,0.0008086988,0.0010701362,0.0028385699,0.0009526675,0.0011191115,0.0008059368,0.0008332677, 0.0012494373, 0.0005474622, 0.0012861884, 0.0013055677, 0.0026272806, 0.0009219052, 0.0012265391, 0.0011404776, 0.0012051921, 0.0011466459, 0.0009422736, 0.0011882251, 0.0016061762, 0.0017002298, 0.0010543345, 0.0014305019, 0.0009765448, 0.0016551414, 0.0015071106, 0.0009334908, 0.0011783813, 0.0025809926, 0.0024930899, 0.0021169154, 0.0014262570, 0.0017019384, 0.0014512346, 0.0012913704, 0.0020135812, 0.0025037096, 0.0030477309, 0.0014514058, 0.0016321700, 0.00085879

ruby - What SHOULD I be seeing to know this code has done what it was supposed to? -

i doing eventmanager tutorial jumpstart labs. not .rb file read .erb file, , think may have solved that, not sure not know should seeing if running correctly , unfortunately tutorial doesn't tell you. here original question now after simple change, no longer getting error - not getting indication code working expected. tutorial says code should creating new directory , storing copy of each 'thank you' letter file called 'output' in new directory. when run see => eventmanager initialized terminal, tells me .rb being read , (i think) .erb being read...but not see new directories/files in file structure, nor indication created - can't tell if doing anything. i kind of expecting see kind of message telling me directory has been created, perhaps file path or something. i have never done , i'm not sure should seeing...can tell me how know code preforming expected? , if not, why? require "csv" require "sunlight/congress" requi

ios - Call function when SwipeGestureRecognizer swipe speed passes threshold -

i'm programming app, contains uiview uiswipegesturerecognizer i want recognizer recognize how fast user dragging in recognizer's direction. when speed high enough (past specific threshold) custom action should occur. it's same in this post , need written in swift. how translate swift or there better way it? current code, xcode errors marked comments. touches began: override func touchesbegan(touches: set<nsobject>, withevent event: uievent) { //avoid multi-touch gesture if(touches.count > 1){ return; } if let touch:uitouch = touches.first as? uitouch{ let locator:cgpoint = touch.locationinview(self.view!) start = locator starttime = touch.timestamp } touches ended: override func touchesended(touches: set<nsobject>, withevent event: uievent) { if let touch:uitouch = touches.first as? uitouch{ let locator:cgpoint = touch.locationinview(

SFML and PN noise (8-bit emulation) -

Image
i have had absurd idea write commodore vic-20 emulator, first computer. everything has gone quite until sound emulation time has come! vic-20 has 3 voices (square waveform) , noise speaker. searching net found pn generator (somewhere called "white" noise). i know white noise not frequency driven, put specific frequency value noise register ( poke 36877,x command). formula is: freq = cpu_speed/(127 - x) (more details on vic-20 programmer's guida, mos6560/6561 vic-i chip) where x 7-bit value of noise register (bit 8 noise on/off switch) i have 1024 pre-generated buffer of numbers (the pseudo-random sequence), question is: how can correlate frequency (freq) create sample buffer pass sound card (in case sf::soundbuffer accepts sf::int16 (aka unsigned short ) values? i guess of had commodore vic-20 or c64 @ home , played old poke instruction... can of me in understanding step? edit: searching on internet found c64 programmer's guida shows waveform

r - Plot two xaxis in one plot? -

Image
this can plotted easily. xvals <- c(5.5, 15.5, 25.5, 35.5, 45.5, 55.5, 65.5, 75.5, 85.5, 95.5) yvals <- c(81, 63, 45, 27, 9, -9, -27, -45, -63, -81) xn <- rep(1000, 10) plot(xvals, yvals) both xvals , xn share same yvals want plot in 1 graph: yaxis: xaxis lower:xvals xaxis upper:xn i want add xn same plot xaxis (the upper) axis(3). idea on this! leave code plot(xvals, yvals) . add following: #plot first plot plot(xvals, yvals) #start new overlaid plot par(new=true) #plot xn remove xaxis , x label plot(xn, yvals, xaxt='n', xlab='') #add @ top of graph (3) axis(3, xn) #bonus. add line add secondary xlabel on top mtext(side = 3, line = 2, "xn") result:

javascript - Setting image dynamically on DataList from an Ajax XML object -

i retrieving xml response ajax call , i'm trying set image on datalist image name comes xml. appears problematic. way trying set image this: $(".image", tablex).attr('src', product.find("image").attr('src')); however, doesn't seem work right because on rendered results see image first item on first row being replicated/rendered on each of newly added items. if set attribute below: $(".image", tablex).attr('123456'); the results same above, believe code within attr has no effect! if set code this: $(".image", tablex).html(product.find("image").text()); can see correct file name being rendered on page. here function: function onsuccess(response) { var xmldoc = $.parsexml(response); var xml = $(xmldoc); pagecount = parseint(xml.find("pagecount").eq(0).find("pagecount").text()); var customers = xml.find("customers"); cus

java - Error while adding items to a list with a wildcard -

private static map<string, list<?>> eventsmap = new hashmap<>(); public static void logevent(string eventidentifier, class<?> event) { if (!eventsmap.containskey(eventidentifier)) { eventsmap.put(eventidentifier, new arraylist<>()); } eventsmap.get(eventidentifier).add(event); } i'm trying make logging class has option log events. purpose used map links identifier list of events. want able put type of object in list, once type of list determined, next items added list have conform first type. example: logwriter.logevent("date", "0:00:01"); logwriter.logevent("date", "0:00:02"); logwriter.logevent("date", "0:00:03"); string[] = {"street", "zipcode", "housenumber", "city"}; string[] b = {"street", "zipcode", "housenumber", "city"}; string[] c = {"street"

c# - Serializing custom IEnumerable<T> as field not working -

i have custom collection looks this: class specialreadonlycollection<t> : ireadonlycollection<t>{ private readonly list<t> entries; public specialreadonlycollection(ienumerable<t> source){ entries = new list<t>(source); } ... } that (among other things) wraps list doesn't offer add method. now have 2 other classes: class a{ public string name; public int value; } class containerofa{ public specialreadonlycollection<a> list; public containerofa(ienumerable<a> source){ this.list = new specialreadonlycollection<a>(source); } } i want serialize containerofa . since don't attributes, how build model , try serialize. // make serializable var metatype = model.add(typeof(a),true); metatype.addfield(1,"name"); metatype.addfield(2,"value"); metatype.useconstructor = false; // make specialcollection serializable model.add(typeof(specialreadonlycol

recursion - check path to see if there is any directory php -

how check if in directory "713" there directory (not files)? has smart enough ignore file existance ... ... $workrecordfullpath = "/var/www/websites/am_dev/app/webroot/files/submissions/57601/4189/713/"; // check if folder "713" exists if (file_exists($workrecordfullpath)) { // check if 713 there directory if (!is_dir($workrecordfullpath)) { return true; } } return false; ... ... $workrecordfullpath = "/var/www/websites/am_dev/app/webroot/files/submissions/57601/4189/713/"; // directories in "713" $submissionworkrecordfullpath = glob($workrecordfullpath . '*' , glob_onlydir); // check if folder "713" exists if (file_exists($workrecordfullpath)) { // check if 713 there directory if (!empty($submissionworkrecordfullpath)) { return true; } } return false; the othe

Error in INSERT statement with PostgreSql and PHP -

i'm using postgresql, php , pdo. i'm getting error , dont know i'm doing wrong. my environment is: postgresql 9.3.6 ubuntu 14.04.2 lts php 5.6.7 apache/2.4.12 (ubuntu) the table i'm using this: -- table: acesso.usuario -- drop table acesso.usuario; create table acesso.usuario ( usuarioidentificador serial not null, usuariopessoafisicaidentificador integer, usuarionome character varying(30) not null, usuarionomecompleto character varying(90) not null, usuariodescricao text, usuariosenha character varying(32) not null, usuariosenhaalterar bit(1) not null, usuariosituacao bit(1) not null ) ( oids=false ); if execute @ pgadmin3 insert acesso.usuario( usuariopessoafisicaidentificador, usuarionome, usuarionomecompleto, usuariodescricao, usuariosenha, usuariosenhaalterar, usuariosituacao) values (null, '', '', null, '', '1', '1'

c# - Hiding repeated rows in telerik RadGrid -

i'm attempting hide duplicate cell values specific columns in telerik radgrid. i attempted use code below not work. stepping through code debugger, can see appears making right decisions. wondering if method i'm using update cell in incorrect or of i'm missing important step. private void hidegridduplicates(radgrid radgrid, string[] fieldnames) { var hashlastvalues = new hashtable(); foreach (string fieldname in fieldnames) { foreach (griddataitem item in radgrid.items) { string currentvalue = item.getdatakeyasstring(fieldname); if (hashlastvalues.containskey(fieldname)) if ((string)hashlastvalues[fieldname] == currentvalue) currentvalue = ""; else hashlastvalues[fieldname] = currentvalue; else hashlastvalues.add(fieldname, currentvalue);

Escape double quote in WCF rest -

we host wcf restful service. there 1 service of verb post, , possible pass in double quotes part of message. causing issues. tried standard slash escape it, didn't work. suggestions? here request body: {"gardenwidth":"16' 7"","gardenlength":"62", "gardenstyle":"general","postalcode":"12345",} try removing comma after "12345": { "gardenwidth": "16' 7\"", "gardenlength": "62", "gardenstyle": "general", "postalcode": "12345" }

haskell - tyConPackage changed from ghc-7.8 to ghc-7.10? -

this ghci session import data.map import data.typeable tyconpackage $ typereptycon $ typeof $ fromlist [(1,2)] gives in ghc-7.8.4: "containers-0.5.5.1" in ghc-7.10.1: "conta_47ajk3tbda43dfwyef3ohq" the new behaviour breaks application, use string programmatically construct documentation urls (pointing html built standalone-haddock) is there way old behaviour? work-around? -- i did more research , found (ghc/compiler/basictypes/module.lhs): 7.8.4 (compiler/typecheck/tcgenderiv builds instance and) uses -- | string identifying package, including version: e.g. parsec-1.0 newtype packageid = pid faststring deriving( eq, typeable ) 7.10.1 (compiler/desugar/dsbinds constructs evidence(?) and) uses -- | string uniquely identifies package. wired-in packages, -- package name, user compiled packages, hash. newtype packagekey = pid faststring deriving( eq, typeable ) well, "uniquely identify" nice, ... -- on other hand, ghci somehow

batch processing - Call a pipeline from a pipeline in Amazon Data Pipeline -

my team @ work looking replacement rather expensive etl tool that, @ point, using glorified scheduler. of integrations offered etl tool have improved using our own python code, need scheduling ability. 1 option looking @ data pipeline, piloting. my problem thus: imagine have 2 datasets load - products , sales. each of these datasets requires number of steps load (get source data, call python script transform, load redshift). however, product needs loaded before sales runs, need product cost, etc calculate margin. possible have "master" pipeline in data pipeline calls products first, waits successful completion, , calls sales? if so, how? i'm open other product suggestions if data pipeline not well-suited type of workflow. appreciate help i think can relate use case. how, data pipeline not kind of dependency management on own. can simulated using file preconditions. in example, child pipelines may depend on file being present (as precondition) before st

Can ciphertext output of AES or RSA encryption be limited to the ASCII-128 character table? -

i'm doing r&d project focused on encrypting information cipher-text , printing code-128 barcode. it understanding since code-128 barcodes can retain ascii table 128 characters. therefore, need know if cipher-text output of modern algorithms such aes or rsa can restricted ascii-128 table. i not doing programming @ point, trying find precedence can done or has been done. if knows answer question, , better yet provide reference example, grateful. bonus question... if restricting ciphertext ascii-128 possible, how affect encryption strength? encode resulting cipher-text, binary, base64 , ascii. able print base64-encoded cipher-text barcode. since base64 encoding decoding doesn't change content, rather changes presentation, doesn't affect underlying cryptography strength. if resulting data won't fit 103 (255) characters of code 128, consider using qr code instead.

coffeescript - Coffescript creating a hashtable -

in following code segment i'm trying create hashtable single key named "one" , push same value "ted" array. out = {}; in [1..10] key = "one"; if(key not in out) out[key] = []; out[key].push("ted") console.log("pushing ted"); console.log(out); what missing? seems output is: pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted { one: [ 'ted' ] } i expect output be: pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted pushing ted { one: [ 'ted','ted','ted','ted','ted','ted','ted','ted','ted','ted' ] } here fiddle: http://jsfiddle.net/u4wpg4ts/ coffeescript's in keyword doesn't mean same in javascript. check presence of value rather of key. # coffee if (key not in out) // .js (r

android - Setting DigitsKeyListener -

i trying assign nummeric input type based on comma decimal point, german locale uses comma decimal point follows in textchangelistener: edittext.setkeylistener(digitskeylistener.getinstance("0123456789,")); however, using stock samsung keyboard (note 10.1 n8000) , stock lg keyboard (lg g3) forces number keypad forcing entering numbers 0-9 without possible decimals. running third party keyboard swiftkey , google keyboard displays nummeric keypad inlcuding decimal , comma. idea how solve problem stock keyboards? there no way this. listener not set keys. keyboard app decides this. listener disallows characters, not keyboard or control keys keyboard wishes display. inputtype used keyboard hint that, keyboard won't know keylistener is, less 1 applied.

Multiple points openlayer and only show the last -

please me problem. i have route finder shows both list , map various points vehicle has passed. when click on item in list, point can seen in map, when have 2 points in same location (eg point1, point2), shows me last point (point2) i have no idea how when click point1 point placed above point2 , vice versa my code is: // when clic in item of list function searchpoint(x, y, zoom) { if (x != 0 && x != '0' && x != '0.0') { map.setcenter( new openlayers.lonlat(x, y).transform( new openlayers.projection("epsg:4326"), map.getprojectionobject() ), zoom ); } } layerrutaspuntoshistorial = new openlayers.layer.vector("rutas puntos historial", { //rendereroptions: { zindexing: true }, strategies: [new openlayers.strategy.fixed()], protocol: new openlayers.protocol.http({ url: "trackweb.asmx/obtenerrutaspuntoshistorial", readwithpost: true, pa

jquery - Get function parameter with url JavaScript -

well, got page load 3 galleries, , each gallery have "view gallery" button. everytime button clicked should load whole gallery in page. should call function loads whole gallery , redirect page images. can't make work. parameter of function passed through value of variable "x", don't know how put value in function, redirection work perfectly. this: while(x <= 3){ imgs.innerhtml += "<div id='gal"+x+"' class='row'>"; imgs.innerhtml += "<div class='eight columns'>"; imgs.innerhtml += "<h4>galeria "+x+"</h4>" for(var = 0; <= 3; i++){ galeria[i] = "foto"+x+"_"+(i+1)+".jpg"; } for(var = 0; < galeria.length; i++){ imgs.innerhtml += "<img src='img/"+galeria[i]+"' class='imgs-galeria'>"; } imgs.innerhtml += "</div>"; imgs.innerhtml += "</di

algorithm - Complex 0/1 Backpack with multiple compartments -

say have 3 compartments in backpack: red, green, blue , 3 sets of items: red items, green items , blue items have weight , benefit. have requirement around total number of total items must placed in each compartment of backpack. red compartment must have 2 red items, green compartment must have 3 green items , blue compartment must have 3 blue items. backpack can hold kind of max weight. need optimize max value given weight. to solve problem attempted use branch , bound technique used solving 0/1 backback. technique computes picks items leave left on space , doesn't return optimal items. what techniques can used solve in reasonable amount of time (aka not brute forcing every possible combination)? unfamiliar dynamic programming better suited or there different technique can use? very interesting problem! yes, problem can solved dynamic programming. to understand how solve, first need understand how knapsack solved using dynamic programming: http://en.wikipedia.or

Remove an open HTML comment with PHP -

i printing chat log php. chatlog, can have user input. i want prevent <!-- entered user commenting out rest of file, reason, code not working. if there <!-- open tag in txt file, comments out rest of code. if there <!-- text --> in file, " text " not echoed. i @ loss, strip-tags should fix this.... i suspecting have error in code allowing this. while(!feof($lfile)) { $line = fgetss($lfile); $lineclean = strip_tags($line); echo $lineclean . "<br>"; } i apologize dirty looking code, expanded troubleshooting. you can pass through htmlentities($line, ent_quotes) , rendered read. prevent xss attacks , other strings malicious intent.

excel - Selecting Where PDF Files Save -

i'm relieved got code below work of community. i have 1 more option on wishlist i'm struggling with. currently, code below save worksheet 3 way worksheet titled "post" separate pdf files folder select. triggered shape. i'm trying make below code prompt folder select users can select pdf files saved, have ideas how this? also, call shell @ bottom preferably open folder files saved, that's not necessary long users know files being saved :) sub saveallpdf() dim integer dim fname string dim tabcount long tabcount = sheets("post").index 'set tabcount last cell want pdf ' begin loop. = 3 tabcount 'set = number of first sheet want pdf in order left right tabcount if sheets(i).visible <> xlsheetvisible else sheets(i) fname = .range("c15") & " " & .range("e13") & "-" & .range("b1") 'the fname above equaling cells pdf&

ruby - Assigning values to a 2D array using "each" method -

i'm trying transpose [[0, 1, 2], [3, 4, 5], [6, 7, 8]] . [[2, 5, 8], [2, 5, 8], [2, 5, 8]] . i can see happening line p transposed_arr not understand why happening. @ every iteration changes every row instead of one. def my_transpose(arr) # number of rows m = arr.count #number of columns n = arr[0].count transposed_arr = array.new(n, array.new(m)) # loop through rows arr.each_with_index |row, index1| # loop through colons of 1 row row.each_with_index |num, index2| # swap indexes transpose initial array transposed_arr[index2][index1] = num p transposed_arr end end transposed_arr end you need make 1 wee change , method work fine. replace: transposed_arr = array.new(n, array.new(m)) with: transposed_arr = array.new(n) { array.new(m) } the former makes transposed_arr[i] same object (an array of size m ) i . latter creates separate array of size m each i case 1: transposed_arr = array.

c++ - Treating derived class as base class - how does it help us to prevent writing more code? -

class shape { void draw (); void move (); void resize (); } class square : public shape { // re implement draw function draws square. void draw (); } void calldraw (shape& arg) { arg.draw (); } int main () { calldraw (square& arg); } (p.s. know need use keyword virtual here make work.) how in preventing writing more code? in function calling draw function arg.draw() . so, how time take write call in main function? what point missing here? it doesn't result in less code; in case lets keep square logic separate triangle logic , circle logic; rather having void draw() { if (issquare) { drawsquare(); } else if (istriangle) { drawtriangle(); } else if (iscircle) { drawcircle(); } } you use switch-case instead of if-else-ifs no matter do, it's going ugly. with virtual methods, adding or removing shape doesn't require going shape.draw() function modify logic (if you've got seve

javascript - Best way to strip quotation marks from form input with jquery -

i have following form input i'm going process: <tr class="formularow"> <input type="text" class="ingredient required" name="ingredient"> </tr> i store value input this: var ingredient = $(".formularow").find(".ingredient").val(); when save array, value stores "something" quotation marks around it. what's best way remove these quotation marks using jquery? the quotation marks meant there state string. eg. ["beef"] array single element containing string beef. normal. the " not part of string, , impossible remove.

citrix - Unable to pass command properly to remote computers in Powershell -

i've got powershell script when copied local remote server , executed remotely using psexec correctly runs , need do. trying adapt same script able run remotely not relying on script being copied , executed remotely psexec. command have citrix xenapp server join farm. # establish variables $zonename = "myzone" $odbcusername = "mycitrixuseracct" $odbcpassword = "mypassword" $licenseservername = "mylicenseserver.company.com" $xaconfigconsoleexe = "c:\progra~2\citrix\xenapp\serverconfig\xenappconfigconsole.exe" $servers = get-content -path .\serverlist.txt foreach ($server in $servers) { # creating mf20.dsn file if ((test-path \\$server\c$\temp\mf20.dsn) -eq $true) { remove-item \\$server\c$\temp\mf20.dsn } add-content \\$server\c$\temp\mf20.dsn "[odbc]" add-content \\$server\c$\temp\mf20.dsn "driver=sql server" add-content \\$server\c$\temp\mf20.dsn "database=mydb" add-content \\$server\c$\temp\mf

Why use Gradle detached configurations? -

i'm reading gradle's detached dependency configurations , api docs' method description says "creates configuration, not add container" . i'd know why want this? at point re-attach dependency configuration? some initial searching revealed plugin related reason not conclusive. there's link in post http://discuss.gradle.org/t/modify-dependencies-of-plugin-checkstyle-configurations/5969 guy complaining plugin configuration polluting project configuration , has explicitly exclude it. second answer question, don't need reattach. guess detached project still available plugin.

select - Using entire query as table name in SQL -

how name entire select statement query table--> (select col1, col2, col3 from customers.. where col1....) table1; i want 3 tables keep on using in same sql syntax. operations later perform on these tables (table1, table2, table3) are- combining them (tablex) , counting values table1 filters , displaying column next tablex. i able in microsoft access, because can store 3 tables, separately manipulate them filters, , write individual queries combining , counting , displaying results 1 final table. not able write single start end query in sql. please help! you can microsoft access, assume not trying use now. in t-sql (sql server), can use with with tab1 ( select * taba ), tab2 ( select * tabb ), tab3 ( select * tabc ) select * tab1 inner join tab2 on 1=1 inner join tab3 on 1=1

c++ - Array Getting Treated Like a Variable in Another Function -

my array being treated variable when pass out of function. have tried multiple fixes , none have seemed work. in readinround function file writes out file i'm reading in. bring update[] array append function can append file i'm writing to. struct masterfile{ string round, id, fname, lname, league, team; double mins, twopta, twoptm, threepta, threeptm, fta, ftm, pertwo, perthree, perft, fouls, turnovers, points;}; struct header{ string record, filename, date, round;}; struct footer{ string record, filename, date, round; int recordcount; double mins;}; struct updatefile{ string record, action, round, id, fname, lname, league, team; double mins, twopta, twoptm, threepta, threeptm, fta, ftm, fouls, turnovers, points;}; int main(){ header header[1]; footer footer[500]; masterfile master[500]; updatefile update[500]; masterfile newmaster[500]; int x = 0; // round counter double roundcount = 0; int u = 0; // new master counter int w = 0; x = readinround(update, master);