Posts

Showing posts from March, 2010

vb.net - How to solve code conversion issue? -

public function savecommentstreecomments(byref f system.windows.forms.form) integer dim isnewsubcomment boolean dim isnewcommentwithsub boolean dim sql string dim rs new adodb.recordset dim commentid short dim subcommentid short dim index short 'wmb 1/28/2004 nextval dim csql string dim crs new adodb.recordset dim cseq double on error goto savecommentstreecommentserror savecommentstreecomments = -1 if not validatecommentstreecomments(f) savecommentstreecomments = -2 exit function end if if f.commentstext(commentstextabbreviation).enabled , f.commentstext(subcommentstextdescription).enabled isnewcommentwithsub = false i getting error below above code while upgrading vb6 vb.net. don't know class missing. 'commentstext' not member of 'system.windows.forms.form' you should change: public function savecommentstreecomments(byref f system.windows.forms.fo

gruntjs - Visual Studio 2015: Destination wwwroot/css/site.css not written because no source files were found. -

i'm trying use grunt in asp project, whatever reasons have stupid warning-message visual studio. how can see down, bower-task has been executed, haven't uglify- , less-tasks. gruntfile.js , folder "wwwroot" in same folder. what's wrong ? this console output in visual studio 2015: > cmd.exe /c grunt -b "c:\t\bw\src\bw" --gruntfile "c:\t\bw\src\bw\gruntfile.js" bower running "bower:install" (bower) task >> installed bower packages >> copied packages c:\t\bw\src\bw\wwwroot\lib done, without errors. process terminated code 0. > cmd.exe /c grunt -b "c:\t\bw\src\bw" --gruntfile "c:\t\bw\src\bw\gruntfile.js" uglify_default running "uglify:uglify_target" (uglify) task process terminated code 0. >> destination wwwroot/lib/angular/angular.js not written because src files empty. >> no files created. done, without errors. > cmd.exe /c grunt -b "c:\t\bw\sr

activerecord - In the rails 4 console, how do I log all sql activity to file BUT not to the console output? -

lots of similar questions ask how hide sql logs in console window, , answers suggest changing log level of active record or turning off ar logging altogether. however still want ar log everything, wanted log file only, , not console output window (as makes console noisy can't see manual logs). how achieve want? this activerecord::railtie code says broadcast logger messages console: # when loading console, force activerecord::base loaded # avoid cross references when loading constant # first time. also, make output stderr. console |app| require "active_record/railties/console_sandbox" if app.sandbox? require "active_record/base" console = activesupport::logger.new(stderr) rails.logger.extend activesupport::logger.broadcast console end so 1 thing when first console set activerecord::base.logger new logger not broadcast messages console. example: activerecord::base.logger = activesupport::logger.new("log/development.log")

javascript - Sencha Touch 2-How to removeAll() in a controller from a store in a view? (SOLVED) -

i want use function removeall() of stores in controller, delete content of store in view.is possible? here code: my view: ext.define('demoapp.view.mainmenu',{ extend:'ext.form.panel', requires:['ext.titlebar','demoapp.store.ccaa'], alias:'widget.mainmenuview', config:{ layout:{ type:'fit' }, items:[{ xtype:'fieldset', items:[{ xtype:'titlebar', title:'menú principal', docked:'top', items:[{ xtype:'button', text:'desconectar', itemid:'logoffbutton', align:'right' }] }, { xtype:'fieldset', items:[{ xtype:'selectfield', itemid:'ccaacombo', label:'comunidad autonoma', store:'st

java.lang.LinkageError using spring and gradle -

i'm trying deploy spring mvc project on tomcat 8.0.22 . user gradle project builder. when try lunch project have error code 500 . this how project : build.gradle file : buildscript { ext { springbootversion = '1.2.3.release' } repositories { mavencentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}") classpath("io.spring.gradle:dependency-management-plugin:0.5.1.release") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot' apply plugin: 'io.spring.dependency-management' jar { basename = 'demo' version = '0.0.1-snapshot' } sourcecompatibility = 1.7 targetcompatibility = 1.7 repositories { mavencentral() } dependencies { compile("org.springframework.boot:spring-boot-starter-web") testcompile("

javascript - Time-series data in JSON -

i need model 1,000,000+ data points in json. thinking of 2 ways of doing this: a) array of objects: [{time:123456789,value:1432423},{time:123456790,value:1432424},....] or b) nested arrays [[123456789,1432423],[123456790,1432424],....] naively comparing these 2 approaches, feels latter faster because uses less characters less descriptive. b faster ? 1 choose , why ? is there 3rd approach ? {time:[123456789,123456790,...], value:[1432423,1432424,...]} why? iterating on primitive array faster. comparable "json size" b) not lose "column" information this npm of interest: https://github.com/michaelwittig/fliptable

sorting - logstash-elasticsearch: sort data by timestamp -

i centralize logfiles 1 logfile using logstash , each event have timestamp(the original one). now, last challenge data sorted timestamp(if possible on real-time thats better). my timestamp format is: yyyy-mm-dd hh:mm:ss now, can make change in format/ file format in order make work, long stays on our servers. what's best way sort data? ideas? thanks in advance!

javascript - How to add an icon inside a textfield -

i have search textfield in toolbar. want add image inside textfield (search icon @ left most) instead of text. please provide ideas achieve this. i recommend use font-awesome load icons. once font awesome library has been added, should this: fiddle: https://fiddle.sencha.com/#fiddle/mmp ext.create('ext.panel',{ renderto: ext.getbody(), width: 500, height: 500, title: 'testing panel', html : 'contents of testing panel', bodypadding: 10, tools:[{ xtype : 'textfield', fieldstyle : 'font-family: fontawesome', emptytext: '\uf002 find user' }] });

sql - Why does my values from matlab GUi failed to be inserted into database? -

i have 3 edit texts in matlab gets user input. i've managed values in array when run disp (data); . how insert text1,text2 , text3 database columns named value1, value2 , value3 respectively using fastinsert ? text1 = get(handles.edit0,'string'); text2 = get(handles.edit1,'string'); text3 = get(handles.edit2,'string'); tablename = 'description'; data = {text1,text2,text3}; colnames = {'value1','value2','value3'}; disp (data); fastinsert(conn,tablename,colnames,data); commit(conn);

python - py2exe fails with "No module named 'clr'" when trying to build exe from script using pythonnet -

i created python script uses pythonnet. script in file named main.py . when run script command line (simply typing main.py @ windows command prompt), imported pythonnet module clr works fine. when try build exe error saying: no module named clr . to isolate cause of this, have verified building executable (in case simple tkinter app) using py2exe works. have python 3.4 installed , have verified where python points c:\python34\python.exe . the error occurs @ executable build time , seems triggered including clr in section {"includes":["sip","clr"]}} in setup.py py2exe . full traceback below: traceback (most recent call last): file "setup.py", line 32, in <module> windows = [{'script': "main.py"}], file "c:\python34\lib\distutils\core.py", line 148, in setup dist.run_commands() file "c:\python34\lib\distutils\dist.py", line 917, in run_commands self.run_command(cmd)

c# - Get elements in list by condition against other list -

i have 2 lists of same object, , of different sizes. i wan't in objects list1 tmdate not exist in list2. public class myobj { public myobj(datetime tmdate) { this.tmdate = tmdate; } public datetime tmdate { get; set; } } var list1 = new list<myobj>(); var list2 = new list<myobj>(); list1.add(new myobj(new datetime(2015, 01, 01))); list1.add(new myobj(new datetime(2015, 01, 02))); list1.add(new myobj(new datetime(2015, 01, 03))); list2.add(new myobj(new datetime(2015, 01, 01))); list2.add(new myobj(new datetime(2015, 01, 02))); var notmatchingobj = list1.where( l1 => list2.any(l2 => l2.tmdate != l1.tmdate)); this code gives me wrong output..i want myobj tmdate 2015-01-03 in case you try one: var result = list1.where(item=>!list2.any(item2=>item2.tmdate==item.tmdate)); this list2.any(item2=>item2.tmdate==item.tmdate) return

ios - Bluemix Push service security concern -

we using ibm push-notification service , mobile-app-security on our bluemix app (serving ios clients). in order send push notification, our server sends post request to: https://mobile.ng.bluemix.net/push/v1/apps/{application-id}/messages with application secret in ibm-application-secret header (following instructions here ). to initialize mobile-app-security sdk inside our app need both application-id , application-secret - means app must contain these values (as constant parameters or download server). if malicious user fetches these values using simple reverse-engineering, able send same post requests, i.e. send push notifications other clients, right? shouldn't there 2 application-secrets? 1 secret app (making hard fake registrations - i.e. require reverse-engineering) , 1 server (which allows send notifications , should never stored on client-side). is possible initialize mobile-app-security ios sdk without application secret? i understand concern. addr

shell - Get current directory and concatenate a path -

this shell script (.sh file). need create absolute path based on current directory. know pwd , how concatenate string? here example of trying do: "$pwd/some/path" sounds want: path="$(pwd)/some/path" the $( opens subshell (and ) closes it) contents executed script outputs put in location in string. more useful getting directory of script running: dot="$(cd "$(dirname "$0")"; pwd)" path="$dot/some/path" that's more useful because resolves same path no matter when run script: > pwd ~ > ./my_project/my_script.sh ~/my_project/some/path rather than: > pwd ~ > ./my_project/my_script.sh ~/some/path > cd my_project > pwd ~/my_project > ./my_script.sh ~/my_project/some/path more complex if need directory of current script running if has been executed through symlink (common when installing scripts through homebrew example) need parse , follow symlink: if [[ "$ostype

c# - Nested Styles in WPF -

i nest style s in wpf. i have resource dictionary: <style x:key="bottombuttonbar" targettype="{x:type grid}"> <style targettype="{x:type button}"> <setter property="margin" value="10,2" /> <setter property="width" value="90" /> </style> <style targettype="{x:type textblock}"> <setter property="horizontalalignment" value="center" /> <setter property="verticalalignment" value="center" /> <setter property="margin" value="2,0"/> </style> </style> what want is: if apply style "bottombuttonbar" on grid, buttons inside grid have margin , width i've defined , same textblock inside grid. how that? i found following solution: <style x:key="bottombuttonbar" targettype="{x:type grid}

c - Memory failure in "?? ()" using GDB -

i'm trying trace segmentation fault using gdb , i'm unable find exact line fault happening. (gdb) backtrace #0 0x00110402 in __kernel_vsyscall () #1 0x007a5690 in raise () /lib/libc.so.6 #2 0x007a6f91 in abort () /lib/libc.so.6 #3 0x007dd9eb in __libc_message () /lib/libc.so.6 #4 0x007e59aa in _int_free () /lib/libc.so.6 #5 0x007e90f0 in free () /lib/libc.so.6 #6 0x080dc4e7 in crypto_free () #7 0x08c36668 in ?? () #8 0x08c44bac in ?? () #9 0x08100168 in bn_free () #10 0x00000009 in ?? () #11 0x08c44ba8 in ?? () #12 0x08108c07 in bn_mont_ctx_free () #13 0xffffffff in ?? () #14 0x08c36630 in ?? () #15 0x08112697 in rsa_eay_finish () #16 0x08c4c110 in ?? () #17 0x08c36630 in ?? () #18 0x081150af in rsa_free () #19 0xffffffff in ?? () #20 0x00000009 in ?? () #21 0x0821870d in ?? () #22 0x000000dd in ?? () #23 0x08c4c110 in ?? () #24 0x08c35e98 in ?? () #25 0x08136893 in evp_pkey_free () #26 0xffffffff in ?? () #27 0x0000000a in ?? () #28 0x08226017 in ?? () #29 0x0

c# - Why does database query look like this? -

i want query database , show result. code: [httpget] public actionresult index(string message) { var result = client in db.clients clients.clientname == message select clients.clientname; viewbag.message = result; getcurrentuser(); return view(); } where message variable taken input element. want show using viewbag.message in view. on page see this: select [extent1].[clientid] [clientid], [extent1].[clientname] [clientname] [dbo].[clients] [extent1] [extent1].[clientname] = @p__linq__0 what mean? the result variable contains linq query - not string. since imply want show 1 message, need first result - not query itself: viewbag.message = result.firstordefault(); this, however, assumes want viewbag.message value of clientname database column (which in turn same message ) , suspect not want... to answer original question: what see result of calling tostring() on dbquery<t> , gives sql query use

Android - GridView forcing update on data change -

i've implemented sample (2. custom adapter example) http://www.mkyong.com/android/android-gridview-example/ , works. i wanted "refresh" data new set, didn't work until did this: imageadapter.notifydatasetchanged(); and removed following check in imageadapter getview method : if (convertview == null) { here current getview method public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); view gridview; // if (convertview == null) { // stopped gridview updating !! if (true) { gridview = new view(context); // layout mobile.xml gridview = inflater.inflate(r.layout.mobile, null); // set value textview textview textview = (textview) gridview .findviewbyid(r.id.grid_item_label); textview.settext(mobilevalues[position]); // set image

SSIS execute sql task get value from a query statement -

Image
i using ssis 2008 , put simple query (not proc) in execute sql task (control flow). query generate 1 column single value, trying based on value decide whether following tasks. tried mapping value variable in parameter mapping. tried direction output/return value etc failed. query takes no parameter. know can create proc output parameter mapped variable wondering if there other options (e.g. not creating proc, it's simple query)? as mentioned, need change sql task give result set on 'single row', can output result set variable. from here can use constraints within control flow execute different tasks based upon outcome variable be; example:

Can't connect to mysql database java -

this question has answer here: connect java mysql database 11 answers i'm trying connect msql database, keep getting error: no suitable driver found jdbc:mysql://localhost:3306/test3. try{ connection con = drivermanager.getconnection("jdbc:mysql://localhost:3306/test3" , "root", "julius"); statement statement = (statement) con.createstatement(); string insert = "insert testtable value ('guy' , '0156421"; statement.executeupdate(insert); }catch(exception e){ system.out.println("error: " + e.getmessage()); } i have not installed mysql connector, since import java.sql.connection;, java.sql.drivermanager;, java.sql.statement; guess wasn't needed. you have register jdbc driver before creating connection. in case mysql driver. download mysql-c

javascript - php dateformat to moment js format -

i have got config php dateformats 'dateformat' => 'd.m.y', 'timeformat' => 'h:i', 'datetimeformat' => 'd.m.y h:i', but datetimepicker need moment.js formatting ( http://momentjs.com/docs/#/displaying/format/ ) so: dd.mm.yyyy hh:mm dd.mm.yyyy hh:mm this no problem me replace d dd , m mm wondering if nobody before has built this. so wrote litte helper function convert php dateformats format needed moment.js function convertphptomomentformat($format) { $replacements = [ 'd' => 'dd', 'd' => 'ddd', 'j' => 'd', 'l' => 'dddd', 'n' => 'e', 's' => 'o', 'w' => 'e', 'z' => 'ddd', 'w' => 'w', 'f' => 'mmmm', 'm' =&

c - How can I give the sourcefilepaths to gcc? -

how can give sourcepaths gcc ? i have .c files in source , test directory. how can give gcc path it? i m compiling a makefile` , message "no such file or directory test.c" my directory structure: make-directory| | |--source | |--header | |--test | |--out | as asked: # makefile generate unit-tests # define directories containing header files other /usr/include # todo headers = :../cunit/headers \ cunit/sources/automated \ cunit/sources/basic \ cunit/sources/console \ cunit/sources/curses \ cunit/sources/framework \ cunit/sources/test \ cunit/sources/win \ cunit/sources/wxwidget \ stub \ ../source \ test sources = cunit/headers \ cunit/sources/automated \ cunit/sources/

How to make use of .jsp LDAP code and other java files in ruby on rails? -

i exited join community. here problem. doing project in ruby on rails develop interface take applications people run algorithm gale-shapely example in background after deadline , output results in new page. had gale shapely algo coded in java , c++ languages. problem have contact ldap server in our institute in-order verify credentials of person willing fill form. , there proper java code written purpose should used in order contact ldap server per our insti rules. ran .jsp code installing tomcat7 , working perfectly. but, problem had written code filling form etc.. in ruby on rails. but, not able use .jsp file in login form in rails. searched lot on net didnt found any. apart problem how run java gale-shapely code in background? 1 solution again re-writing entire code in ruby , use database info run algo. there method can give database info java program , capture output? i solved using netldap gem present in rails. realized similar java code uses ldap library, there ne

Rails action Mailer raise_delivery_errors, how does it works? How to detect bounces? -

i have rails 4.2.0 application sends lots of mails, it's elearning platfrom. at moment have problems bounces, lots of mails coming because mail-adresses aren't valid. one way solve problem manually, starting deleting them database. thats not suitable because there 10000 users registered. now questsion is config.action_mailer.raise_delivery_errors = true exactly? do? , how response this? does mail() function got return value can see if mail send or not? and there methods or best practices detect actionmailer, if mail delivered or not? if set false , mail silently catch , ignore exceptions raised through attempting deliver email. reference . in production set false , because otherwise failed email throw error end user. in development set true . take @ this gem . among other features there method check if mail bounced .

c# - WPF - Fire comboBox SelectedIndexChanged only from user click -

i want stop combobox_selectionchanged event being fired @ ui loading. should happen when user makes change in combo box. to this, have written following in .xam.cs file. private void mycombobox_selectionchanged(object sender, selectionchangedeventargs e) { combobox cb = (combobox)sender; if (!cb.isfocused) { return; } else viewmodel.onpropertychanged("myproperty"); } but not fire event when user makes change. have gone wrong ? i know there similar question in stackoverflow. solutions in did not work me. pls help. found solution. need combine selection_changed event previewmousedown event. could selectionchanged event in wpf handled user interaction?

memory management - Is .bss not a part of final ELF? -

Image
here below linker descriptor file input gnu ld build u-boot elf embedded system output_format("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") output_arch(arm) entry(_start) sections { . = 0x00000000; . = align(4); .text : { arch/arm/cpu/armv7/start.o (.text) *(.text) } . = align(4); .rodata : { *(sort_by_alignment(sort_by_name(.rodata*))) } . = align(4); .data : { *(.data) } . = align(4); . = .; __u_boot_cmd_start = .; .u_boot_cmd : { *(.u_boot_cmd) } __u_boot_cmd_end = .; . = config_sys_nand_u_boot_size + config_sys_text_base; . = align(4); .rel.dyn : { __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; } .dynsym : { __dynsym_start = .; *(.dynsym) } .bss : { __bss_start = .; *(.bss) . = align(4); _end = .; } /discard/ : { *(.dynstr*) }

c# - Consume Extension method in non-static class -

all of examples extension methods have seen consume extension method in class like: class program { static void main() { ...call extension method here } } these seem work because consuming class static. there way consume extension method in non static class below? can't seem find examples this. i have extension method class: using system; using system.collections.generic; namespace awesomeapp { public static class linqextensionmethods { public static ienumerable<t> finditemsbeforeandafter<t>(this ienumerable<t> items, predicate<t> matchfilling) { if (items == null) throw new argumentnullexception("items"); if (matchfilling == null) throw new argumentnullexception("matchfilling"); return items; } } } and have class consumes extention method namespace awesomeapp { public class leaders : ileaders

multithreading - C# pass function with return and parameter to Thread -

i created function paramter , return value. following code: static void main(string[] args) { string url = "url"; thread thread = new thread( () => readfile(url) ); thread.start(); } public static bool readfile(string url) { bool result = true; return result; } how can return value method inside of thread? the signature method passed thread void method(object) , in other words can't return anything. 1 way handle allow both thread , the main code access same variable, can used signal result: class someclass { private static bool threadresult; static void main(string[] args) { string url = "url"; thread thread = new thread(() => readfile(url)); thread.start(); ... // when thread completed, threadresult can read } private static void readfile(string url) {

php - Unexpected T_Variable with SimpleXML -

i mistake parse error: syntax error, unexpected '$xml2' (t_variable) in /users/craftamap/www/craft_cms/index.php on line 4 by using code. if (file_exists("xml/sites.xml")) { $xml2 = simplexml_load_file("xml/sites.xml"); } i can't figure out mistake. file existing. thank help.

python - How to pass tuple1 if ... else tuple2 to str.format? -

put simply, why following error? >>> yes = true >>> 'no [{0}] yes [{1}]'.format((" ", "x") if yes else ("x", " ")) traceback (most recent call last): file "<stdin>", line 1, in <module> indexerror: tuple index out of range i use python 2.6. ☞ indexing option: when accessing arguments’ items in format string, should use index call value: yes = true print 'no [{0[0]}] yes [{0[1]}]'.format((" ", "x") if yes else ("x", " ")) {0[0]} in format string equals (" ", "x")[0] in calling index of tulple {0[1]} in format string equals (" ", "x")[1] in calling index of tulple ☞ * operator option: or can use * operator unpacking argument tuple. yes = true print 'no [{0}] yes [{1}]'.format(*(" ", "x") if yes else ("x", " ")) when invoking

java - How to create the CXFServlet? -

prior cxf-3.1.0 1 use new org.apache.cxf.transport.servlet.cxfservlet() instantiate servlet, or via web.xml configuration: <servlet> <servlet-name>cxfservlet</servlet-name> <display-name>cxf servlet</display-name> <servlet-class> org.apache.cxf.transport.servlet.cxfservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> but when upgrade 3.1.0, class cannot found anymore. how the servlet created cxf? i have simple spring boot application works correctly cxfservlet - here extract pom.xml: <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <start-class>demo.demoapplication</start-class> <java.version>1.7</java.version> <cxf.version>3.1.0</cxf.version> </properties> <dependency> <groupid>org.apache.cxf</groupid> <a

c++ - Building libtorrent with openssl with BJam -

i trying build libtorrent ( http://www.libtorrent.org/ ) using provided jamfile. if try build in vanilla state goes well. building using command: bjam msvc-12.0 boost=source however want build openssl there seem support for. run problems. because first time use bjam (actually else make files). try run following command: bjam msvc-12.0 boost=source encryption=openssl now compiler starts complain not finding openssl include files. guess have include path in jam file. have no idea where. tried add path include environment varaible in windows doesn't seem picked bjam or msvc. suggestions? my understanding of how done on windows installing libraries , headers visual studio's include , lib folders. (that's how install openssl on windows @ least). the jamfile supposed pick cxxflags , ldflags environment variables, use introduce library- , include paths. however, when boost=system specified, i.e. you're building against "system" boost libr

c# - Use an Enum for a Console Command Library (With Implementations) -

i have researched on youtube nothing has come up, on google. please show how use enum console command library, or better way process commands. appreciated. parsing console commands difficult well, , common problem has been solved many times. library you, or @ least provide examples. if want parse commands being entered program (ie if writing shell of kind) gnu readline option available source code (though in c). information here: http://web.mit.edu/gnu/doc/html/rlman_1.html see post c# alternatives readline: is there .net library similar gnu readline? if parsing stuff passed program command line options, 1 option getopt: http://www.gnu.org/software/libc/manual/html_node/getopt.html this post talks c# alternatives getopt: getopt library c#

jsf - Get new instance of session scoped bean with other name -

i have session scoped bean ui edit data. annotated @named , @sessionscoped , runs in jboss 6.2. got requirement similar edit ui. problem 2 uis can exist in parallel. perfect reuse nice create new instance of bean name. unfortunately have no clue how in clean cdi way. don't inherit bean , give name. 1 of ideas. idea implement in managed bean business logic , keep data encapsulated them , set data object inside managed bean when needed in specific context. maybe there cdi way producers or something? changing scope of bean viewscope makes no sense in case. thanks oliver but maybe there cdi way producers or something indeed, could use producer. kickoff example: @sessionscoped public class sessionbean { @produces @named("foo") @sessionscoped public sessionbean getasfoo() { return new sessionbean(); } @produces @named("bar") @sessionscoped public sessionbean getasbar() { return new sessio

underscore.js - Using Underscore Count and Total Array Elements -

let's have these 2 javascript arrays: var types = ["w", "x", "y", "z"]; var data = [["x", 3], ["y", 4], ["x", 2], ["z", 6], ["z", 3], ["x", 1], ["z", 2]]; using underscore.js want produce these 2 results: var counts = [["w", 0], ["x", 3], ["y", 1], ["z", 3]]; var totals = [["w", 0], ["x", 6], ["y", 4], ["z", 11]]; the counts array counts number of instances each element appears in data array. totals array sums elements appear in data array type. need code work when there elements in types array don't appear in data array - in case there no "w" elements in data. thanks in advance. i looping (underscore way) var types = ["w", "x", "y", "z"]; var data = [["x", 3], ["y", 4], ["x", 2], [&quo

Trouble viewing Azure DocumentDB DocumentClient traffic in fiddler -

i'm having trouble viewing viewing communications azure documentdb .net sdk documentclient in fiddler . edit: specifically, don't see traffic when i'm querying documents. see document creation posts. i have no filters operating in fiddler , code create client: var endpointuri = new uri(settings.default.endpoint); _client = new documentclient(endpointuri, settings.default.authkey, new connectionpolicy { connectionmode = connectionmode.gateway, connectionprotocol = protocol.https }); i've explicitly set connection policy although think default gateway. any ideas or insights? thanks, chris. are iterating through results in query? nature, linq iqueryables use deferred execution: http://blogs.msdn.com/b/charlie/archive/2007/12/09/deferred-execution.aspx . another possibility if you're looking post in fiddler trace, note in 1 specific case (a query no filters), query executed operation ins

android - How to add item in Setting->Display->Wallpaper->Choose wallpaper from? -

Image
i want add item in setting->display->wallpaper->choose wallpaper from. how , please tell me,thanks.. that list of activities, first ensure have created activity entry point app list. then, open androidmanifest.xml , add following <intent-filter> activity want listed: <activity android:label="@string/activity_label" ...> <intent-filter> <action android:name="android.intent.action.set_wallpaper" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> the text of added item label of activity ( android:label="@string/activity_label" )

sql server - SNIReadSyncOverAsync Performance issue -

recently used dot trace profiler find bottle necks in application seen in of places taking more time , more cpu usage sninativemethodwrapper.snireadsyncoverasync() called execute reader method of ado.net , don't know why it's taking more time. if run same query in sql server running fast. does know why it's taking more time? alternative ado.net method?

css - After 2nd <li> the submenu is disappearing -

i did change bootstrap 3 drop-down behavior on click on hover adding css .dropdown:hover .dropdown-menu { display: block; } it's working. sub-menu has more 2 <li> tags , when hovering below 2nd <li> sub-menu disappear. <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">exhibitor <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">opportunities</a></li> <li><a href="#">exhibitor list</a></li> <li><a href="#">market information</a></li> <li><a href="#">floor plan</a></li> <li><a href="#">pricing</a></li> </ul>

java - Execute tests sequentially using Arquillian TestRunner TestNG -

i can use arquillian testrunner junit container write sequential tests. import org.jboss.arquillian.junit.insequence; import org.jboss.arquillian.junit.arquillian; @runwith(arquillian.class) public class classtotest{ @test @insequence(1) public void test1() { // test (1) } @test @insequence(2) public void test2() { // test (2) } } it possible same thing using arquillian testrunner testng container? if how can that. yes. can sequencing of test methods dependency chaining in testng. it below @test public void test1() { // test (1) } @test(dependsonmethods = { "test1" }) public void test2() { // test (2) } please refer below more info http://www.tutorialspoint.com/testng/testng_dependency_test.htm

javascript - In wordpress to attach different js files -

in wp 4.2 project attach js files like: add_action('wp_print_scripts', array(&$this, 'admin_load_scripts')); ... function admin_load_scripts() { wp_register_script('backendartistssongsjs', $this->plugin_url . 'js/backend-scripts.js'); ... but want different pages attach different js files. can in these ways: in admin_load_scripts parse parse $_server , depending on current url attach js file need. in related php file include file need. if there better way , way prefer? if want load script on particular page can use <?php if( is_page('<page-name>')) { ?> // import <?php } ?>

io - How to zip files and folders in Java? -

please have @ below code. public void startcompress(string path,string filename,string outputlocation,int compresstype,int filsize) throws exception { system.out.println("input location: "+path); system.out.println("output location: "+outputlocation); system.out.println(compresstype); byte[] bs=new byte[filsize]; system.out.println(filsize); fileoutputstream fos=new fileoutputstream(outputlocation+"/test.zip"); system.out.println(fos.tostring()); zipoutputstream zos=new zipoutputstream(fos); zipentry ze = new zipentry(filename); zos.putnextentry(ze); fileinputstream inputstream=new fileinputstream(path); int len; while((len=inputstream.read(bs))>0){ zos.write(bs, 0, len); } inputstream.close(); zos.closeentry();

Convert binary to hex in node.js -

i want ask want convert binary data hex before insert table. var net = require('net'); var server = net.createserver(function(socket){ socket.on('data',function(data){ var bindata= data.tostring('binary'); //filter(bindata); //if no error convert hex. var hexdata = bindata.tostring('hex'); //insert hexdata here. }); server.listen(3030,'127.0.0.1', function () { console.log("server listenining"); }); but problem binary data inserted. thank in advance. parseint("10101001", 2).tostring(16) // => "a9" edit: think misunderstood question. data starts out buffer , convert string, want hex? if so, data.tostring('hex') . if have manipulated bindata , reconstruct buffer: var bindata = data.tostring('binary'); // bindata var hexdata = new buffer(bindata, 'ascii').tostring('hex');

javascript - How to add or bind classes to both parent and child elements of dynamically loaded data using ajax call? -

i new jquery , struggling here past 1 week.i loading data json array using ajax call, , using 1 "swipe" plugin swipe , load images on page on same div. don't know how add class both parent div , child elements. code is: url : "http://my_ip/app/event_h/get_a_evnts", type:"post", datatype:"json", success: function(data) { var event1=data.event1; var total_event=event1.length; var event1=data.event1; var dom=$('#dom'); var path="http://my_ip/app/"; var media1=data.media; var location=json.location; var event2=data.event; var rating=data.rating; var event1[i].event_id =1;//this value retrived json array var output= '<div class="container-fluid" ><section class="row">'; output +='<div class="col-sm-12 col-md-12 col-xs-12"><div class="pane

Yii2 advanced application doesn't work on production server -

i installed yii2 advanced application on local server , works fine, without configured .htaccess . on server doesn't work, /frontend/web/index.php url. check out php version of hosted server, require php 5.5 version. thank you...

php - elasticsearch generic query that works for any search -

Image
i stuck generic query audit project consists of on million+ records. there generic query generate using php or jquery code? till here using and , or operators same: { "filter": { "and": { "filters": [ { "term": { "age": "28" } } ] }, "or": { "filters": [ { "term": { "name": "varsh" } } ] } } } is there way can use operator , field search for? ui looks we have quite same approach in our application. users can build own query similar ui (the difference have sub-group, can have nested queries). we use ast store users queries, : ["a",["o",[{"t":"g

excel - Generate x, y coordinates from input parameters -

Image
i trying overlay patient data on top of optical image. need assign x,y coordinates each patient file in bunch of designated boxes in optical image. i doing hand wanted try , automatically giving excel starting coordinate (for upper left corner pixel of each box), number of rows , columns box spacing between each pixel. need x , y coordinates in separate cells. for instance, box 3 rows, 4 columns, pixel spacing of 20 , starting coordinates of (20,50), output should like: x y 20 50 40 50 60 50 80 50 20 70 40 70 60 70 80 70 20 90 40 90 60 90 80 90 according description maybe: formulas: a8 : =if(row(1:1)<=$b$1*$b$2,$b$4+mod(row(1:1)-1,$b$2)*$b$3) b8 : =if(a8,$b$5+$b$3*int((row(1:1)-1)/$b$2)) both formulas copied downwards needed. transposed version: formulas: b7 : =if(column(a:a)<=$b$1*$b$2,$b$4+mod(column(a:a)-1,$b$2)*$b$3) b8 : =if(b7,$b$5+$b$3*int((column(a:a)-1)/$b$2)) both formu

c++ - How to Twirl, Whirl, Spiral in dimensions higher than 2D -

i have code following in c++: for(int x = position.x; x < position.x + dimensions.x; ++x) { for(int y = position.y; y < position.y + dimensions.y; ++y) { glm::vec2 tc = glm::vec2(x,y); tc -= spiralposition; float distance = glm::length(tc-position); if(distance < spiralradius) { float percent = (spiralradius - distance) / spiralradius; float theta = percent * percent * angle; float s = std::sin(theta); float c = std::cos(theta); tc = glm::vec2(glm::dot(tc,glm::vec2(c,-s)),glm::dot(tc,glm::vec2(s,c))); } tc += spiralposition; returnvalues[x][y] = noise->getvalue(tc); } } what does, produces container of gradient noise values. while this, spirals results around epicentre, cyclone. it's based on code here, results identical: http://www.geeks3d.com/20110428/shader-library-swirl-post-processing-filter-in-glsl/ what i'd extend

internet explorer - Passing configurations to IE addon -

i have ie addon written in c++ using bho want use log4net introduce logging addon. don't intend have ui (dropdown etc) plugin. therefore, enable, disable , set log levels, options have? 2 options thought include getting configs file (with caveats when running in protected mode). second option read somewhere, load url, through can pass arguments. eg, read first url on ie startup , if matches particular string, use set arguments logging session (otherwise use default). any other better option? thanks! another way store settings in registry. there caveats here protected mode, deterministic usable way turning logging on/off. in protected mode ie map registry brunch here: hkey_current_user\software\microsoft\internetexplorer\internetregistry please note, such redirecting work hkcu, not hklm

How do I calculate the years from Jan 1st 1990 until today's date in Oracle SQL? -

how this, without getting negative value.? sysdate gives current date. using extract : sql> select extract(year sysdate) - 1990 years dual; years ---------- 25 or, using months_between , floor : sql> select floor(months_between(sysdate, to_date('01/01/1990','mm/dd/yyyy')) /12) 2 "years" 3 dual; years ---------- 25

android - How to suppress logging with Google Analytics 7.3? -

the latest update google play services 7.3 makes ga's logger interface deprecated , , cannot control logging level inside our app anymore. this interface deprecated. logger interface deprecated. use adb shell setprop log.tag.gav4 debug enable debug logging google analytics. we used have different settings per build type, using logger.setloglevel() (the guide seems outdated): verbose debug , error release, our tracking information available during development. now latest update, can run adb shell setprop log.tag.gav4 verbose will able see sending google analytics, or can see else logging (those use 7.3). is there way avoid this? in google analytics changelog page can see ga version 4.5 version included in google play services 7.3 (may 1, 2015) https://developers.google.com/analytics/devguides/changelog you can change default logger custom implementation: custom implementations of logger can used: // provide custom logger. googleanalytics.

c++ - QDialog remove title bar -

Image
the net flooded similar questions, have seen nothing suits solve problem @ hand. in qt-c++ app, have mainwindow form functions, there qpushbutton, pressing qdialog opens. now, functionalities in forms work fine, want final application without top title bar. i.e. no close / minimize / maximize button. in main.cpp have done -- int main(int argc, char *argv[]) { qapplication a(argc, argv); mainwindow w; w.setwindowflags(qt::window | qt::framelesswindowhint); w.show(); return a.exec(); } as result mainwindow has become - for dialog.cpp window, have set - dialog::dialog(qwidget *parent) : qdialog(parent), ui(new ui::dialog) { ui->setupui(this); //qdialog dialog(0, qt::customizewindowhint|qt::windowtitlehint); --- used also; no use qdialog dialog(0, qt::framelesswindowhint | qt::dialog); but title bar of qdialog remains, looks - where going wrong ??? ideas on how remove close button , title bar ??? i needed same

string matching in javascript / regex -

what best way match 2 strings contain same phrase? example there way match following 2 strings: st1 = 'jenissplendidicecreams' st2 = 'jenisicecream' what proper regex match 2 strings? you need build regexp looks this: /.*j.*e.*n.*i.*s.*i.*c.*e.*c.*r.*e.*a.*m.*/ this regexp matches if string being tested includes original characters, in order, arbitrary additional characters in between. we can build enough doing function make_regexp(str) { var letters = str.split(''); letters.push(''), letters.unshift(''); return new regexp(letters.join('.*')); } > make_regexp('jenisicecream') < /.*j.*e.*n.*i.*s.*i.*c.*e.*c.*r.*e.*a.*m.*/ now test if second string matches: > make_regexp('jenisicecream').test('jenissplendidicecreams') < true