Posts

Showing posts from April, 2012

node.js - how to get the raw version of a template string in iojs -

Image
is possible raw version of template string in iojs ? var s = `foo${1+1}bar` console.log(s); // foo2bar in previous example string: foo${1+1}bar edit1 : need detect whether template string depends on context of if is 'constant' string may contain cr , lf is possible raw version of template string in iojs ? no not. it's not possible raw representation of literal, there no way "raw" literal in these cases: var foo = {[1+1]: 42}; var bar = 1e10; var baz = "\"42\""; note term "template string" misleading (as may indicate somehow raw value of string (which not case shown above)). correct term "template literal ". my need detect whether template string depends on context of if is 'constant' string may contain cr , lf seems job static analysis tool. e.g. can use recast parse source code , traverse template literals. for example, the ast representation of `foo${1+1}bar` is : if suc...

Dynamically sum row values based on column headers? - Excel -

need solutions queries posted in below link, http://www.mrexcel.com/forum/excel-questions/334740-dynamically-sum-row-values-based-column-headers.html having personweek separate column sum of weeks should displayed. quest: dynamically sum row values based on column headers? it form re-post question in entirety on site; nevertheless: what looking relatively straight forward. there lot of ways accomplish suggest use combination of 'match' function , the 'offset' function. offset function creates range based on given start point, moving up/down / left/right indicated, given height / width. example: =offset(b2,1,2,3,4) indicates range d3:g5. range given starting @ cell b2, moving 1 row down , 2 columns right, , going total of 3 rows , 4 columns. so remaining point determine start , stop offset. first, first field in offset function cell a1, top-left corner of data table. find how many rows move down, need find project referring (i assume cel...

javascript - How to create ajax request in AngularJs? -

this question has answer here: what best practice making ajax call in angular.js? 4 answers i want send requests , responses using angularjs, haven't tried yet. the $http -service looking for. comes preconfigured get , post methods make easy requests, can configure requests wish.

.net - How do I use JSON.NET to deserialize into nested/recursive Dictionary and List? -

i need deserialize complex json blob standard .net containers use in code not aware of json . expects things in standard .net types, dictionary[string, object] or list[object] "object" can primitive or recurse (dictionary or list). i cannot use static type map results , jobject/jtoken don't fit. ideally, there way (via contracts perhaps?) convert raw json basic .net containers. i've search on way coax json.net deserializer creating these simple types when encounters "{}" or "[]" little success. any appreciated! if want generic method can handle arbitrary json , convert nested structure of regular .net types (primitives, lists , dictionaries), can use json.net's linq-to-json api it: using system.linq; using newtonsoft.json.linq; public static class jsonhelper { public static object deserialize(string json) { return toobject(jtoken.parse(json)); } private static object toobject(jtoken token) { ...

java - How to create many-to.many association with extra columns? -

i'm using hibernate , spring data. i have 3 tables, first composite primary key. table (grupo) ---------------- |pk idgrupo | |pk nombre | | | |______________| also created 2 more tables usuario , grupo_matricula(result of relation many many between grupo , usuario). table (grupo_matricula) ------------------ |pk idgrupos | | matricula_id | | grupos_id | | nombre | | aceptado | | propietario | | | |_________________| table (usuario) ---------------- |pk matricula | | nombre | | password | |______________| i created 3 clases 1 entity (grupo), other pk embeddedid of grupo last entity (grupo_matricula). @entity @table(name = "grupo") public class grupo implements serializable { @embeddedid protected grupopk grupopk; @onetomany( mappedby = "grupo_id", cascade=cascadetype.all) private set<grupomatricula> grupomatriculas=new hashset<>(0); } ...

AcroForm PDF to normal PDF in c# -

i have acroform pdf (a pdf can edited) i'm using api sign pdf requires pdf normal 1 , never acroform one. is there way transform acroform pdf normal one? i tried making read-only though cannot edited still acroform pdf. in answer comment, assume using itextsharp, though not specify. using itextsharp, believe need flatten form when done. here simple example: public void generatepdf(string filepath, list<pdffield> modifiedfields) { var pdfreader = new pdfreader(filepath); var folderstructure = filepath.split('\\'); if (folderstructure.length == 0) return; var currentfilename = folderstructure.last(); var newfilepath = string.format("{0}{1}", constants.saveformspath, currentfilename.replace(".pdf", datetime.now.tostring("mmddyyhhmmss") + ".pdf")); var pdfstamper = new pdfstamper(pdfreader, new filestream(newfilepath,...

ios - Transition without loose data with Storyboard and Swift -

i'm developing new project in swift i've big (and dumb) problem. i've 3 viewcontrollers: 1.- call webservices, take json , pass json second view 2.- parsing data , put data in view (tableview , ok). @ view go other view button (to view 3). don't need pass nothing. 3.- try go view 2 view empty because data posicioning @ tableview pass view 1. i try lot of solutions: navigationcontroller!.dismissviewcontrolleranimated(false, completion: nil) -> if link storyboard transition view 3 view 2, view 2 empty, if don't link in storyboard -> unexpectedly found nil while unwrapping optional value if change "!" "?" nothing the same every code have been test. my code is: view 1 view 2: (connected in visual part of storyboard (ib)) @ibaction func gorecibospendientes(sender: uibutton) { let controllervc = self.storyboard!.instantiateviewcontrollerwithidentifier("recibos") as! tablarecibostableviewcontroller ...

node.js - get Selected fields in .populate() waterline-postgresql .populate('fieldName',{select:[]}) -

select query not working in .populate() of waterline-postgresql. model.find(query).populate(assoc.alias,{select:['field1','field2']}); this not working in waterline-postgresql adapter. is not supported or making mistake? select not supported in .populate(). can see github issue . in populate select not working currently. this feature request , open issue. hope in next release waterline team introduce feature.

android - Gettting error while adding Facebook SDK in build.gradle -

Image
i working on project need implement facebook login. purpose followed steps developer website mentioned. unfortunately getting build error after adding 'com.facebook.android:facebook-android-sdk:4.1.0' in build.gradle as follows apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.example.facebook" minsdkversion 11 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavencentral() } dependencies { compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.facebook.android:facebook-android-sdk:4.1.0' } error log getting: error:a problem occurred configuri...

github - Change the author of last commit in Git(pushed remotely) -

i trying change author name of last commit. mentioned in change commit author @ 1 specific commit , executing git commit --amend --author="author name <email@address.com>" command. in git log can see name , email have been changed. when executing git push -f , giving me following error remote: prevent losing history, non-fast-forward updates rejected. ! [remote rejected] dev -> dev (pre-receive hook declined) any idea how can push this. thanks, shantanu your remote server preventing push. need (temporarily) configure permit pushing non-fast-forward changes branch achieve want. how depends on server using; example, if it's bare git repository on server can change git config receive.denynonfastforwards false .

html - How do I set the offset of a div from the top of an outer div to be the same as the offset from the side of the outer div using only css? -

Image
so made mockup of want it's easier understand. have outer div takes 33% of page , inner div has width of 50% (of outer div). outer div has "text-align: center;" style space on each side of inner div 25% width of outer div. want offset inner div top of page same distance top sides. of responses similar questions advise using jquery, prefer use css-only solution if there one. how can this? i apologize if basic question. inexperienced frontend , couldn't find way of setting css attributes equal values of other attributes. any appreciated! the css: .side{ background-color: #eceff1; height: 100%; width: 33%; text-align: center; } .profpic{ width: 50%; border-radius: 50%; position: relative; } the html: <div class="side mdl-shadow--4dp" > <image class="profpic mdl-shadow--4dp" src="/profpic.jpg"></image> <...

c# - Concatenate a string and decimal in a Linq query -

i writing application in vs2010, framework 4.0, c# , silverlight 4. i have simple class , linq query. the class is: public class pmdues { [key] public int duesid { get; set; } [datamember] public string dues_type { get; set; } public decimal dues_amount { get; set; } } in domainservice have following iqueryable: public iqueryable<pmdues> getdues() { return dues in objectcontext.tblduesrates orderby dues.due_type select new pmdues() { duesid = dues.id, dues_type = dues.due_type, dues_amount = dues.amount.value }; } so far good.......but! what want display dues_type + dues_amount concatenated. dues_amount declared decimal in sql server table. don't know , how concatenate dues_type dues_amount. tried following did not work. should concatenation in class? if how. still kind of new c#. public iqueryable...

Call python script from c++ without loading the file each time -

i have python script need call lots of times (around 160000 times) , while can in less second hard c++ code, if try load , call python script this, take hours! think if loaded script once, run loaded script on , over, faster. unfortunately, don't know how this. don't think can load file ifstream , use pyrun_simplestring on lines of string. in case isn't faster however, possible return 2d array in python, convert array std::vector ? consider following function, in file called multiply.py #!/usr/bin/python3 def do_multiply(a, b): c = 0 in range(0, a): c += b return c in c++ file: // load function pyobject *pname = pyunicode_fromstring("multiply"); pyobject *pmodule = pyimport_import(pname); pyobject *pfunction = pyobject_getattrstring(pmodule, "do_multiply") let's want call function 3 times, follows: struct numberpair { int x; int y; }; std::vector<numberpair> numberpairs { {1, 2}, {...

c# - No Repeated Primary Key -

protected void btn_insert_click(object sender, eventargs e) { int result = 0; storageprice sp = new storageprice(tb_priceid.text, tb_storagename.text, tb_desc.text, decimal.parse(tb_storeprice.text), int.parse(tb_outletid.text)); result = sp.storagepricinginsert(); if (result > 1) { response.write("<script>alert('storage remove successfullly');</script>"); } else { response.write("<script>alert('storage removal not successfull');</script>"); } response.redirect("storagepricingview.aspx"); } c# file public int storagepricinginsert() { int result = 0; string querystr = "insert storagepricing(pricing_id, name, description, pricing, outlet_id)" + "values (@pricing_id, @name, @description, @pricing, @outlet_id)"; try { sqlconnection conn = new sqlconnection(connstr); sqlco...

Rename filenames and remove gaps in the order with batch -

i'm wondering how rename screenshots in screenshot folder number order. remove screenshots, game fills in gaps causes chronological issue. it looks this: screenshot0000.jpg screenshot0002.jpg screenshot0005.jpg and rename them this: screenshot0000.jpg screenshot0001.jpg screenshot0002.jpg i hope don't ask here i'm sure give shot. @echo off setlocal enableextensions enabledelayedexpansion pushd "x:\where\thefiles\are" && ( set "count=10000" /f "delims=" %%a in ('dir /b /on "screenshot*.jpg"') ( echo ren "%%~fa" "screenshot!count:~-4!.jpg" set /a count+=1 ) popd ) this output console rename commands. if output correct, remove echo command.

windows - Adding UEFI firmware boot entry using bcdedit -

how add new uefi firmware boot menu entry(in nvram) using bcdedit . e.g. tried following steps boot entry not getting added. bcdedit /create /d "linuxloader" /application osloader this return new guid (say newguid) bcdedit /set {newguid} device partition=s: bcdedit /set {newguid} path \boot\efi\bootx64.efi bcdedit /set {fwbootmgr} displayorder {newguid} /addfirst thanks in advance. you cannot use applications of type osloader boot linux: kind windows loaders, such application boot applications (not same efi applications ), signed microsoft exclusively , launched windows boot manager (see first slides of this uefi document description of process.) on other hand, should possible add boot manager along windows', , register within uefi (in nvram storage); steps same wrote, use bcdedit /create /d "linuxloader" {bootmgr} as first operation. theory of operation of bcdedit ( bcdsrv really) that, @ last step, entry should copied nvram w...

Excel VBA Adding records below existing values -

i've been developing little tool query's our database , returns references. i'm having problem adding newly query'd values below existing values in excel sheet1 . option explicit public ref string const dwconnectstring = "provider=sqloledb... " public property rref() string rref = me.textbox1.value ref = trim(rref) end property private sub textbox1_change() dim rref string rref = me.textbox1.value end sub private sub zoekref_click() dim cn object dim rs object dim cm object dim ref string dim strsource string dim startrow integer ref = rref set cn = createobject("adodb.connection") cn.open dwconnectstring set rs = createobject("adodb.recordset") 'rs = new adodb.recordset strsource = "select consignment.consignment, consignment.document_remark_2, invoice_hist.net_amount, invoice_hist.vat_amount, invoice_hist.inv_currency " strsource = strsource ...

ios - Share Pin using Pinterest SDK -

Image
i'm trying post pin app pinterest . i followed there documentation : ios pin sdk . it's simple, each time try pin image app raise exception, or pinterest app opened when pin image got error: it seems there problem in right client id . i searched problem , found result: message sent deallocated instance using pinterest sdk , didn't work me! my code: var pin = pinterest(clientid: "1446186", urlschemesuffix: "prod") var urll = nsurl(string: "http://placekitten.com.s3.amazonaws.com/homepage- samples/200/287.jpg")! var sourceurl = nsurl(string: "http://placekitten.com")! pin.createpinwithimageurl(urll, sourceurl: sourceurl, description: "pinning pin demo") try following code....its using in project... _pinterest = [[pinterest alloc] initwithclientid:@"xxxxx" ]; nsstring *imagekey =[nsstring stringwithformat:@"%@",url]; nsstring *captionkey = tempcaption; nslog(@"pinterest :...

java - Red5 Error executing call: Service: null Method: closeStream Num Params: 0 -

i'm getting quite few of the following errors on red5 1.0.5 using windows 2008 r2 server. i tried putting closestream function in server app hasn't seemed help. 2015-07-07 21:08:10,458 [rtmpconnectionexecutor#dcfplxm1yixyj-1] error o.r.server.service.serviceinvoker - error executing call: service: null method: closestream num params: 0 java.lang.reflect.invocationtargetexception: null @ sun.reflect.generatedmethodaccessor59.invoke(unknown source) ~[na:na] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.8.0_45] @ java.lang.reflect.method.invoke(method.java:497) ~[na:1.8.0_45] @ org.red5.server.service.serviceinvoker.invoke(serviceinvoker.java:193) ~[red5-server-common-1.0.5-release.jar:na] @ org.red5.server.net.rtmp.rtmphandler.invokecall(rtmphandler.java:210) [red5-server-common-1.0.5-release.jar:1.0.5-release] @ org.red5.server.net.rtmp.rtmphandler.oncommand(rtmphandler.java:269) [red5-server-commo...

google maps - Add a button with onclick event in infowindow -

i trying add button onclick event in infowindow of google map api v3 var cont = "<div><h4><b>transformer</b></h4><label>name: </label>"+this.transformername.charat(0).touppercase()+this.transformername.substring(1)+"<br><label>site no: </label>"+this.siteno+"<br><label>substation no: </label>"+this.substationno+"<br><label>transformer no: </label>"+this.unitno+"<br><button onclick='voltagemodel()'>voltagetrend</button></div>"; console.log(cont); infowindow.setcontent(cont); but onclick event not firing kindly help try <button onclick='voltagemodel();'>voltagetrend</button> you missed ;

java - Add Active Class to Selected Page (With and Without Trailing Slash) -

i've got selector adding "active" class selected page. working trailing slash, e.g. if its: site.com/test/ works fine. however if site.com/test doesnt. this causing issues when using "back" button takes me page without trailing "/" here code: $(document).ready(function () { $('a[href="' + this.location.pathname + '"]').parent().addclass('active'); }); can amend add class both variations? also, if possible can amended adds active class parent, if select childpage of parent? e.g. site.com/test/edit test set active. thanks str.replace(/\/+$/,'') + '/' make sure string ends / , code this: $(document).ready(function () { str = this.location.pathname.replace(/\/+$/,'') + '/'; $('a[href="' + str + '"]').parent().addclass('active'); }); if don't know if links end slash, can check everything: $(document).ready(f...

r - auto.arima with allowmean = T is the same as allowmean = F -

im runing auto.arima forecast package allowmean = t , allowmean = f , exact same results - , both of them include intercept. does has idea doing wrong , how resolve issue? following repreducable example: library(forecast) set.seed(1) z=arima.sim(n = 101, list(ar = c(0.8))) ts.plot(z) runing auto.arima allowmean = f produces: > auto.arima(z,d = 0,max.p = 7,max.q=0,stepwise= f ,allowmean = f) series: z arima(1,0,0) non-zero mean coefficients: ar1 intercept 0.7275 0.4241 s.e. 0.0688 0.3012 sigma^2 estimated 0.7118: log likelihood=-126.52 aic=259.05 aicc=259.29 bic=266.89 which same allowmean = t: > auto.arima(z,d = 0,max.p = 7,max.q=0,stepwise= f ,allowmean = t) series: z arima(1,0,0) non-zero mean coefficients: ar1 intercept 0.7275 0.4241 s.e. 0.0688 0.3012 sigma^2 estimated 0.7118: log likelihood=-126.52 aic=259.05 aicc=259.29 bic=266.89 i'll thankful ideas. this appears bona f...

Android Intent in Preferences -

i have pro , free version of app. both have backup activity don't want android activity chooser show when user has both versions installed. therefore have created 2 product flavors (free , pro) have 2 different preferences.xml's in pro preferences.xml use intent show datamanagement activity: <preferencecategory android:key="datamanagement_category" android:title="@string/settings_datamanagement_title" > <preferencescreen android:summary="@string/settings_datamanagement_message" android:title="@string/settings_datamanagement_title" > <intent android:action="com.sourcecastle.logbook.datamanagementactivity" /> </preferencescreen> </preferencecategory> <activity android:name="com.sourcecastle.logbook.datamanagementactivity" android:exported="true" android:label="@string/datamanagement_title" > ...

html5 - How I can do vertically center alignment in TEXTAREA in HTML? -

i want vertically center alignment of text in text-area. please suggest how can this? there 2 ways it direct positioning textarea <textarea style="height: 300px; width: 400px;; top:50%; margin-top: -150px; position: absolute;"> </textarea> use table property in element style <div style=" display: table-cell; vertical-align: middle; height: 300px; width: 400px;"> <textarea style="height: 200px; width: 500px; display: table-cell;"></textarea> </div>

java - MS SQL vs Oracle Order By -

Image
i'm confronted guess oracle nulls problem - not sure - oracle giving me different result ms sql. column (day) trying order date/time column , id column varchar: here, on left result way want - same sql oracle i'm getting different(read: wrong) result. far i've looked in internet has fact cannot find c ids on 2015-01-01 , 2015-01-02 - thats why pushes sole c result in beginning. whats more strange fact not order right - ms sql server: 2015-01-01 2015-01-01 2015-01-02 2015-01-02 2015-01-03 2015-01-03 2015-01-03 oracle: 2015-01-03 2015-01-01 2015-01-02 2015-01-03 2015-01-01 2015-01-02 2015-01-03 ->the query quite simple: select id,day dayidtable order day in java web app - how can make sure use same sql caters both ms sql , oracle databases? appreciated! thanks. i have 1 request please ! know result of oracle not make sense "theoretically" - thats - before question gets bloated "not possible" answers request people answer if have ...

javascript - color, insert link and insert image popup not showing in wysihtml5 -

hey every 1 have following issues color , insert link , insert image popup not showing in wysihtml5 . when check inspect element div insert image button after update , in inspect element <div class="bootstrap-wysihtml5-insert-image-modal modal fade in" style="display: none;"> and automatically add when click button style="display: none;" this have modal class , modal class inherit bootstrap. modal class have 2 properties overflow: 'hidden'; display : none; when remove property inspect element popup showing other wise popup not showing should please me.. the overflow: 'hidden'; part wrong. remove display: none; done programmatically. code should be: overflow: hidden;

string - Converting a str to a &[u8] -

this seems trivial, cannot find way it. for example, fn f(s: &[u8]) {} pub fn main() { let x = "a"; f(x) } fails compile with: error: mismatched types: expected `&[u8]`, found `&str` (expected slice, found str) [e0308] documentation , however, states that: the actual representation of strs have direct mappings slices: &str same &[u8]. you can use as_bytes method: fn f(s: &[u8]) {} pub fn main() { let x = "a"; f(x.as_bytes()) } or, in specific example, use byte literal: let x = b"a"; f(x)

licensing - Datastax Enterprise license pricing per node -

we have cluster of 5 node. since datastax community edition doesn't offer reliable technical support, planning purchase datastax enterprise. i know cost of datastax enterprise license per node. send mail info@datastax.com, sales reach out.

IntelliJ cant locate the 'src' folder from a cloned project in Github. -

Image
i cloned project in github intellij java project , project contains java source code, downloaded including 'src' , 'iml', readme , '.idea' (i double checked , yes downloaded correctly). moment open project project seems cant find src, here looks : as can see in above image 'src' folder seems missing although downloaded, things missed in cloning? , how can fixed it? looks algorithm.iml file not added module project. there option add project in context menu if right-click on .iml file.

javascript - Handling async ajax calls within django session -

i have django application, template contains loop in javascript, iterates of check-boxes in table. each check box, send ajax request view function, want save id of check box in list or remove id list (depends on check state). need list part of request.session dictionary. results show me ajax calls asynchronous , makes list wrongly updated, , inconsistent. there thread safe data structures can store part of session, , ensure sync list updating? javascript , ajax: function checkall(source, type) { checkboxes = document.getelementsbyname(type); for(var i=0, n=checkboxes.length;i<n;i++) { if (checkboxes[i].checked != source.checked) { checkboxes[i].checked = source.checked; select_row(checkboxes[i], source.checked); } } } function select_row(row_selector, is_checked) { is_box_checked = typeof is_checked !== 'undefined' ? is_checked : row_select...

php - Strip all elements inside a specific element when descendant elements have same name as ancestor -

i'm using php , strip out tags inside specific tag , keep plain text. issue i'm stuck on there child tags have same name of parents tags: <corpo> <num>1.</num> <mod id="mod167"> string 1 <commas id="mod167-vir1" type="word">string 2</commas> <com id="mod166-vir1-20090024-art13-com16.1"><num>&lt;&lt;16.</num></com> <rif xlink:href="urn" xlink:type="simple">string 3</rif><h:p>something here</h:p> <corpo>string 4</corpo> </mod> </corpo> here, example, corpo have child tag same name ( <corpo>string 4</corpo> ) , num tag used 2 times ( <num>1.</num> , <num>&lt;&lt;16.</num> ) inside parent tag corpo . starting highest corpo tag strip out every child tag , keep plain text. result should be: <corpo...

regex - Removing characters after a EURO symbol in R -

i have euro symbol saved in "euro" variable: euro <- "\u20ac" euro #[1] "€" and "eurosearch" variable contains "services defined in sow @ price of € 15,896.80 (if executed fro" . eurosearch [1] "services defined in sow @ price of € 15,896.80 (if executed fro" i want characters after euro symbol "15,896.80 (if executed fro" using code: gsub("^.*[euro]","",eurosearch) but i'm getting empty result. how can obtain expected output? you can use variables in pattern concatenating strings using paste0 : euro <- "€" eurosearch <- "services defined in sow @ price of € 15,896.80 (if executed fro" sub(paste0("^.*", gsub("([^a-za-z_0-9])", "\\\\\\1", euro), "\\s*(\\s+).*"), "\\1", eurosearch) euro <- "$" eurosearch <- "services defined in sow @ price of $ 25,196.4 (if executed fro...

cq5 - Vanity URLs Dispatcher Cache Invalidation - Adobe AEM/CQ -

i trying configure dispatcher invalidation configuration per adobe dispatcher invalidation documentation . per documentation cache invalidation requests page generated aliases or vanity urls configured in page properties. i created vanity url in page properties dialog. when publish page vanity url property set, can see logs in disptacher.log checking [/dispatcher/invalidate.cache] activation detected: action=activate [/content/geometrixx/en/products] touched /app/server/aem-apache/htdocs/cache/.stat response.status = 200 response.headers[server] = "communique/2.6.3 (build 5221)" response.headers[content-type] = "text/html" cache flushed "get /dispatcher/invalidate.cache" 200 13 0ms but when check configured (inside dispatcher.any) docroot cache folder inside apache web server. cache corresponding full page path cleared (e.g. /content/geometrixx/en/products in logs). vanity url accessed file (e.g. /mysite/prodct.htm) still there. do need m...

java hashmap word count from a text file -

i trying code read info text file, need find out how many times each word separated white space occurs. need output in alphabetical order count of each word. looking use treemap, keyset() , iterator. code incomplete , quite stuck. import java.util.hashmap; import java.util.map public class wordcount<e extends comparable<e>> { private static map<string, integer> map = new hashmap<string, integer>(); static { fillmap(map, "alice.txt"); } private static void fillmap(map<string, integer> map, string filename) { } } this exact code asked for. save every word , count them. if word gets didn't exist, add map, if did, increase value. @ end, print keys , values. use it, if got question, ask. import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.ioexception; import java.util.hashmap; import java.util.map; impo...

sql server - Pass datatable as paramater in stored procedure -

is possible pass datatable parameter stored procedure ? so, like exec mystoredprocedure @mydatatable i using sql server 2008. you need create user-defined table type first. -- create data type create type udtt_table table ( column1 int, column2 varchar(10), column3 datetime ) go you can use user-defined table type in stored procedure following, create procedure usp_user ( @usertable udtt_table readonly ) ... ....

matlab - how to pass command line argument that is a matrix to R CMD BATCH -

i use rscript matlab, , want send matrix rscript command line. have read this post , examples in post passed number or small matrix or arrary. question how pass matrix rscript command line. thank in advance! code in matlab: data=dlmread('test.txt') data = 5 5 477 5 300 696 5 595 227 195 5 646 195 300 606 195 595 783 system('rscript.exe test.r data'); code in r: options(echo=true) # if want see commands in output file args <- commandargs(trailingonly = true) if(length(args)==0) { print("no arguments supplied.") } print(args) a1 <- as.numeric(args[1]) a1 <- data.frame(a1) print(a1) i don't think matlab can pass data stdin of command called system . options are: write data out file in way can read in within rscript process (e.g. csv). potentially temporary file, , filename passed argument r script. encode data in cross-program way can passed command-line ar...

AngularJs+TypeScript:-How to get the selected index value in ng-select -

Image
i m working on module have check condition visibility of panel if slected index of dropdown not equal 0 or -1 make visible panel else not. bit confused how selected index value of dropdown using ng-select . have shown dropdown code below:- <div data-ng-app="customernew" data-ng-controller="createcustomerctrl custom" ng-init= getformdata(); > <table> <tr> <td> <select id="accountselector" style="width: 100%;"> <option value="0">--- select option ---</option> <option data-ng-repeat="acnt in listaccounttypes" value="{{acnt.id}}">{{acnt}}</option> </select> </td></tr> </table> </div> here typescript controller /// <reference path="../interface/interface.ts" /> /// <reference path="../../scripts/typings/jquery/jquery.d.ts" />...

ruby on rails - Undefined method `javascript_link_tag' -

im sure simple fix i've been on problem 2 hours now. all im trying load user index view has boostrap table. in view have loading js files. when try try access through broswer receive error. anyone have clues how fix , have js files load? undefined method `javascript_link_tag' here user index view <%= javascript_link_tag 'datatables.bootstrap.js' %> <%= javascript_link_tag 'jquery.datatables.min.js' %> <%= javascript_link_tag 'jquery-1.11.1.min.js' %> <div class="page-header"> <h1><%= @user.username %> <small>edit items</small></h1> </div> <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>image</th> <th>title</th> <th>price</th> <th>actions</th> </tr> ...

sqlite - Rails Migration - Constraints not working -

i'm new ruby on rails (switched laravel) , don't understand how migration constraints work. in migration file have: t.string :username, null: false, limit: 20 t.index :username, unique: true but when try create user username length exceed limit of 20 characters (or no value), works, unique constraint works , give me warning if try create second user same username. i use sqlite development. when development.sqlite3 file, seems ok: "username" varchar(20) not null if me, appreciated :) thanks

android - AlertDialog not applying custom theme -

i increase textsize of alert dialog message text, added following styles: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="apptheme" parent="@android:style/theme.holo.light.darkactionbar"> <item name="android:actionbarstyle">@style/mainactionbar</item> <item name="android:textappearance">@android:style/textappearance</item> <item name="android:textappearancelarge">@android:style/textappearance.large</item> <item name="android:alertdialogstyle">@style/alertdialog</item> </style> <style name="textappearance" parent="@android:style/textappearance"> <item name="android:textsize">24sp</item> </style> <style name="textappearance.large"> <item name="android:textsize"...

c# - Why HttpClient blocks forever with chunked encoding? -

here's simple code snippet: var httpmessage = new httprequestmessage(httpmethod.get, "https://google.com")) var task = client.sendasync(httpmessage, httpcompletionoption.responseheadersread); var response = await task; this code works fine. when replace custom server gives me chunked encoding "await task" hangs forever. i've got backing code working through streamsocket , know server works fine. read http headers, parse incoming chunks e.t.c. problem why httpclient hangs chunked encoding? update: i forgot mention i'm using customhttphandler allow untrusted certificates. /// <summary> /// httpmessagehandler lets use windows runtime ihttpfilter types /// </summary> public class customhttpclienthandler : httpmessagehandler { static readonly list<chainvalidationresult> allowedcertificateerrors = new list<chainvalidationresult>(){ chainvalidationresult.expired, chainvalidationresu...

java - How to set offset committed by the consumer group using Spark's Direct Stream for Kafka? -

i trying use spark's direct approach (no receivers) kafka , have following kafka configuration map: configmap.put("zookeeper.connect","192.168.51.98:2181"); configmap.put("group.id", uuid.randomuuid().tostring()); configmap.put("auto.offset.reset","smallest"); configmap.put("auto.commit.enable","true"); configmap.put("topics","ipdr31"); configmap.put("kafka.consumer.id","kafkasparkuser"); configmap.put("bootstrap.servers","192.168.50.124:9092"); now objective is, if spark pipeline crashes , started again, stream should started latest offset committed consumer group. so, purpose, want specify starting offset consumer. have information offsets committed in each partition. how can supply information streaming function. using javapairinputdstream<byte[], byte[]> kafkadata = kafkautils.createdirectstream(js, byte[].class, byte[].class, ...

c# - get data from datalayer into observablecollection in View -

i data datalayer class viewmodel doesn't observablecollection binded listbox in view. public class viewmodel : notifyuibase { public viewmodel() { findimagecommand = new relaycommand(findimage); } public observablecollection<image> findvisualreferences { get; set; } public relaycommand findimagecommand { get; private set; } private void findimage() { string searchterm = this.searchbox; var dbfunctions = new databasefunctions(); findvisualreferences = dbfunctions.findvisualreferences(searchterm); } } i've tested findvisualreferecences(searchterm) method , gives items needed fill observablecollection. tested databinding view , that's working to. when place method in constructor observablecollection gets filled public viewmodel() { var dbfunctions = new databasefunctions(); findvisualreferences = dbfunctions.findvisualreferences(searchterm); } but need ...

gd - Php, rotate and paste thumbnails in circle -

i'm trying create image in server, composed of 12 different images distributed in circle (like numbers in clock: image corresponding number 6 should vertically flipped. every new image rotates 30º), can't find proper way so. have tried composition client-side (with aim upload it) css , using html2canvas create new image in base64, doesn't support 'rotate', , 'translate' properties yet. experiments i've done in server, far, result in bunch of black squares contain portion of rotated image... images png , have no alpha. advice on this? try below code js fiddle <img src="http://lorempixel.com/output/nature-q-c-100-100-9.jpg"/> img{ border-radius:50%; -webkit-transition: -webkit-transform .8s ease-in-out; -ms-transition: -ms-transform .8s ease-in-out; transition: transform .8s ease-in-out; } img:hover{ transform:rotate(360deg); -ms-transform:rotate(360deg); -webkit-transform:rotate(360deg)...

python - Checking if a person and getting details -

i'm new sparql , want details of on dbpedia such birthplace etc, first want check type person. query far looks like: select ?person ?birthplace { {?person dbpedia-owl:person.} union {dbpedia:stephen_fry dbpprop:birthplace ?birthplace .} } i want details of on dbpedia such birthplace etc, first want check type person. if want persons first, , then get, e.g., name, can take advantage of fact sparql sub-select queries evaluated first: select ?person ?name { { select ?person { ?person dbpedia-owl:person } limit 10 } ?person foaf:name ?name . } sparql results that has advantage can select number of persons first, , whatever names might have. e.g., results query above have more 10 results, since persons have more 1 foaf:name property. however, you're asking rather unusual. you're looking names of persons, you'd typically write query says find persons , names: select ?person ?name { ?person dbpedia-owl:person . ?person f...

c# - Bind Bool to Visibility of TextBlock within a ListBox -

i want bind visibility of textblock , within listbox , bool value in viewmodel . binding works textblock outside listbox , isn't working textblock within listbox . please help! xaml code: <textblock x:name="heading" visibility="{binding myvb.visible, converter={staticresource booltovisconverter}}" width="480"/> <listbox x:name="lstbani1" itemssource="{binding users}"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="vertical"> <textblock x:name="tb1" text="{binding string1}" visibility="{binding myvb.visible, converter={staticresource booltovisconverter}}" width="480"/> <textblock x:name="tb2" text="{binding string2}" width="480"/> <textblock x:name="tb3" ...

java - How to find data between two different dates? -

i want find data between 2 dates , display results in table. below code doesn't work. ps = dbconnection.cn.preparestatement("select bill_no, date, cust_name, contact_no, reg_no, model, cc, qty, engine_no, chasis_no, payment_mode, grand_total stock date = '$from' , '$to' "); you should use between operator: select bill_no, date, cust_name, contact_no, reg_no, model, cc, qty, engine_no, chasis_no, payment_mode, grand_total stock date between '$from' , '$to' mandatory comment: using string replacements leaves code vulnerable sql injection attacks. should consider using prepared statements instead.