Posts

Showing posts from January, 2010

vba - Excel format rule highlight duplicates based on each date column entry -

this excel doc kind of guestbook, there numerous people's names , date visited on (written 11/17/2014). the doc sorted date, there 100 or 200 names 11/17/2014, 200 or 11/18/2014... goes on bunch of consecutive dates. i want write formatting rule highlights if there name duplicates during duration of each day in date column. rid of duplicates, , have accurate representation of people visiting per day. things tried: regular dupe checker in conditional formatting - easy run dupe check within 1 column. dupe check based on 2 columns. there many dupes visitors returning daily. the built-in formatting rule custom formula writer - easy "highlight occurrences column cell , column b cell equal" not if 2 cell patterns occurred more once. the macro writer - i'm pretty rusty on visualbasic might faster @ generic dupe checking 100k or entries manually highlighting each day range. tl;dr - highlight 'name' , 'date' pattern occur more once. any s

Google maps V2 android get current location -

im trying place marker on position am, way: googlemap = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map_container)).getmap(); googlemap.setmylocationenabled(true); my question is, how coordinates mylocation, tried, googlemap.getmylocation().getlatitude() , googlemap.getmylocation().getaltitude() right after googlemap.setmylocationenabled(true), app crashes, thing did location loc=lm.getlastknownlocation(provider) not same coordinates , marker placed in wrong place. how can people me? supportmapfragment mf =(supportmapfragment)getsupportfragmentmanager().findfragmentbyid(r.id.map); mmap = mf.getmap(); mmap.setmylocationenabled(true); mmap.setmaptype(mmap.map_type_normal);

gulp-less not creating output css -

i've been struggling few hours now. have following in gulpfile: gulp.task('styles', function() { gulp.src('c:\\teamcity\\buildagent\\work\\5003e8de5901599\\dev\\content\\css\\less\\dealer-landing.less') .pipe(less()) .pipe(gulp.dest('c:\\teamcity\\buildagent\\work\\5003e8de5901599\\dev\\content\\css')); }); i run 'gulp styles' completes no errors, .css never created. tried commenting out middle line seen below , works expected; less file gets copied dest directory: gulp.task('styles', function() { gulp.src('c:\\teamcity\\buildagent\\work\\5003e8de5901599\\dev\\content\\css\\less\\dealer-landing.less') //.pipe(less()) .pipe(gulp.dest('c:\\teamcity\\buildagent\\work\\5003e8de5901599\\dev\\content\\css')); }); any idea why gulp-less doesn't generate css? if use less, file generated correctly. i experienced due undefined class in less file. i discovered undefined class through logging

linux - LD_PRELOAD causing segmentation fault in dynamic library loader -

i have written library intended loaded via ld_preload . on linux systems, causing dynamic library loader segfault during initialisation. i have simple test case exhibits behaviour, if link -lm . example: # works fine gcc -o vecadd.normal -std=c99 vecadd.c -lopencl ld_preload=/path/to/my/library.so ./vecadd.normal # causes segmentation fault gcc -o vecadd.broken -std=c99 vecadd.c -lopencl -lm ld_preload=/path/to/my/library.so ./vecadd.broken the strange thing libm.so seems included in both versions: ldd shows same set of libraries, in different order: vecadd.normal: linux-vdso.so.1 => (0x00007fffed9ff000) libopencl.so => /usr/lib64/libopencl.so (0x00007f135c9b1000) libc.so.6 => /lib64/libc.so.6 (0x00007f135c61c000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f135c418000) libnuma.so.1 => /usr/lib64/libnuma.so.1 (0x00007f135c20f000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f135bf08000) libm.so.6 => /lib64/libm.so.6 (0x00007f135bc84

android - Tests fail when device screen is sleeping -

i trying run calabash tests on android device. if manually turn screen before running tests works. on nexus 4 if turn screen off , try run tests first scenario times out waiting elements appear. on galaxy nexus if start tests screen off calabash wakes device , tests pass. are there devices calabash cannot wake up? nexus 4 1 of these? turning on devices manually not feasible since run these tests on many devices. i have found outdated references issue. post 2012 adam niedzielski @ https://groups.google.com/forum/#!topic/calabash-android/o6luueougte suggests following hook in app_life_cycle_hooks.rb include calabash::android::operations afterconfiguration |config| wake_up end but code added ruby-gem/bin/calabash-android in calabash explicitly disallows inclusion of operations module: https://github.com/calabash/calabash-android/commit/995daef9b6636e7e4e572aeb5d4f90d6d072320f guess no longer recommended approach. if remove include , type calabash::android::operations.wa

ios - UITableViewCell label is not updating -

i have seen many posts on here nothing seems working. trying update custom uitableviewcell label setup in storyboard. using code when receive update notification during download: nsindexpath *index = [self.fetchedresultscontroller indexpathforobject:myobject]; mylisttableviewcell *cell = (mylisttableviewcell *)[self.tableview cellforrowatindexpath:index]; //get update value cell.bottomlabel.text = [nsstring stringwithformat:@"%.1f mb of %.1f mb", megabytesdownloaded, totaldownloadestimate]; i can see in logs values correct, , breakpoint on update line hit when should be, label updates when interact cell, or reason,a few seconds after download process has completed. i using afnetworking , of iboutlets have been checked again , again. how can update cell in real time? you calling cellforrowatindexpath outside of tableview reload. either give reused cell or brand new instance not cell shown on screen @ time. what should call reloadrowsatindexpaths:withrowa

c++ - Direct And Indirect Recursion Issue -

so i'm having recursion bug. output want... input 4 * * * * * * * * * * * * * * * * * * * output get.. input 4 * big blank space* i cant seem wrap head around recursion. #include<iostream> #include<fstream> #include<string> #include<windows.h> #include<ctime> using namespace std; int i; bool end = false; int changer = -1; int placeholder; bool recursionup(int num1) { if(num1 == placeholder) { return true; } for(i = placeholder; == num1; i--) { cout << "*"; } cout << "\n"; recursionup(num1 + 1); } bool cont = false; int recursion(int num1) { if(num1 == 0) { cont = recursionup(num1); } for(i = 1; <= num1; i++) { cout << "*"; } recursion(num1 - 1); if(cont) { return 0; } } int main() { int number; cout << &

python - Class and function scope -

i want create instances of class string user has typed in used exec( ) function. problem can't access instance name outside function. first thought problem scope of function, , still think when put instances in list can access them, not using name. i'm not sure happening here.. there way access instances name, thing1.properties outside function because not whole code messy put outside function? create list of instances in function , "extract" instances outside function access them outside function. here code: class things: def __init__(self, properties): self.properties = properties listt = [] def create_instance(): exec("thing1=things('good')") listt.append(thing1) create_instance() print listt[0].properties print thing1.properties while abhor polluting global namespace, exec statement can take second argument used scope , defaults locals() : >>> def foo(name): ... exec "{} = 1".format(n

node.js - How to reuse gulp tasks for multiple nodejs projects -

i trying reuse gulp tasks in 2 different projects. extract gulp tasks parent directory , trying require them in. here directory structure. parent/ gulp-tasks/ default.js project1/ node_modules/ gulpfile.js js/ project2/ node_modules/ gulpfile.js js/ this have in gulpfile.js in each project var requiredir = require('require-dir'); requiredir('../gulptasks'); here default.js looks like: var gulp = require('gulp'); gulp.task('default', function() { //run code here }) when try run gulp default , gulp not defined. know there no node_modules in parent directory, there way point node_modules in each of child projects? not particularly wanting answer gulp how structure projects make code reusable? why need structure way? can break them down repos? way can install each of them dependencies. you can have package.json within parent root. have access shared

javascript - what does fn.apply(fn, []) do? -

i have piece of code accepts fn argument , stores in object property. var obj = {}; function anotherfn(fn){ obj["name"] = fn.apply(fn, []); } function google(){ console.log("hello"); } anotherfn(google); console.log(obj.name); what not understanding fn.apply(fn,[]) code , purpose. use call , apply method when want execute fn in different this/context . but fn.apply(fn, []) here?. confusion why can't do obj["name"] = fn(); fn.apply(fn, []) calls function stored in fn context (the value of this while executing function) of fn , , arguments contained within [] (no arguments). it seems odd call apply in way, when have been equivalent call fn.call(fn) . fn() not appropriate replacement, fn() execute in global context, means value of this within function window (assuming browser environment).

javascript - Kendo window.refresh not successfully grabbing partial view -

all. thank in advance. i have window refresh every time dropdown selection changed (or button pressed). controller being called upon refresh, view not being called/refreshed, reason. missing fundamental? window: @(html.kendo().window() .name("editwindow") .title("edit contact") .loadcontentfrom("_contactedit", "contacts", new { selectedcontact = model.contactid }) .content("loading...") .visible(false) .draggable() .resizable() .width(400) .modal(true) .actions(actions => actions.pin().minimize().maximize().close()) ) refresh code (in javascript): var combobox = $("#contactid").data("kendocombobox"); var contactid = combobox.value(); var window = $("#editwindow").data("kendowindow"); window.refresh({ url: "../../contacts/_contactedit", data: { selectedcontact: contactid } //url: "/cont

Using CSS to create a fixed Background image -

Image
i have been unable create background image (gray rectangle) stays in fixed position. . when scroll down page, image continues scroll page instead of staying stationary images do. this gray background image being used create outline left hand navigation. body.ms-backgroundimage { background: url(../landingpage/laipic1.png); background-size: 250px 455px; background-position: 8px 280px; background-attachment: fixed; background-repeat: no-repeat; } to have menu sit on side of page going want use css attribute position: absolute; . place you'd use top: 100px; left:10px; using whatever values like. using can place you'd on page , should stay no matter when scrolling. can put script editor on page if want there or in file in style library , reference in master page.

Spark- Saving JavaRDD to Cassandra -

http://www.datastax.com/dev/blog/accessing-cassandra-from-spark-in-java the link above shows way save javardd cassandra in way: import static com.datastax.spark.connector.cassandrajavautil.*; javardd<product> productsrdd = sc.parallelize(products); javafunctions(productsrdd, product.class).savetocassandra("java_api", "products"); but com.datastax.spark.connector.cassandrajavautil.* seems deprecated. updated api should be: import static com.datastax.spark.connector.japi.cassandrajavautil.*; can show me codes store javardd cassandra using updated api above? following documentation , should this: javafunctions(rdd).writerbuilder("ks", "people", maptorow(person.class)).savetocassandra();

c# - delete same value listbox and arraylist -

foreach (student student in liststu) { listbox1.items.add(student.tostring()); } foreach (staff staff in liststa) { listbox1.items.add(staff.tostring()); } i have 2 arraylist liststa liststu used fill listbox. i'm trying delete listbox , arrylist @ same time , i'm trying remove() don't know how correct value listbox delete in arraylist. for (int = listbox1.selectedindices.count - 1; >= 0; i--) { listbox1.items.removeat(listbox1.selectedindices[i]); liststa.remove(listbox1.selectedindex.tostring()); } how correct value listbox use arraylist's remove() the issue here .remove trying find specific string value, not index. for example, you're trying remove string "2" arraylist of objects, not index 2 it sounds wish remove index, use .removeat on arraylist well listbox1.items.removeat(listbox1.selectedindices[i]); liststa.removeat(listbox1.selectedindices[i]); this requires listtsa , listbox1 kept in sync

c# - Read Specific Value from .txt file and storing it in a variable -

i looking read .txt file in c# specific value store in value example have text file, example.txt , having several lines searching line states damian:2014/12/04 then store 2014/12/04 initialized value example datetime storedate; using example managed read lines in file , search specific file, dont know how store , trim capture date , date interchangeable the date follows im trying get. int counter = 0; datetime storedate; string line; streamreader file = new streamreader(@"c:\example.txt"); while ((line = file.readline()) != null) { if (line.contains("damian:")) // im stuck next } file.close(); if(line.contains("damian:")) storedate = datetime.parse(line.replace("damian:","").trim()); would simplest way grab date you're after.

mysql - Delete rows in table based on values in other table -

i have simplified table (table1): id | note ---------------------------------- 1 | note 2 | note 3 | note 4 | note and 1 (table2): id | note ---------------------------------- 1 | note 2 | note 3 | note 4 | note based on id table1 want delete rows table2 table1.note equal table2.note. if provide tabel1´s id=3, rows id 2 , 4 of table2 should deleted. i tried: delete table2 join table1 id = ? table1.note = table2.note but getting "er_parse_error". what correct mysql syntax? you can join between table1 , table2 in delete statement. delete t2 table2 t2 join table1 t1 on t1.note = t2.note , t1.id =3

caching - Multiple file system caches causing havoc for each other -

relatively new go , can't figure out if i'm doing stupid (quite likely) or if there's bug (unlikely given i'm doing stupid). have 2 filesystem cache's using beego's filesystem cache . 2 separate folders. when try writing each cache try retrieve values results mixed up. can tell creation of mycache gets overridden othercache in init() function: package main import ( "github.com/astaxie/beego/cache" "log" ) var ( mycache cache.cache othercache cache.cache err error ) func init() { if mycache, err = cache.newcache("file", `{"cachepath":".cache/mycache","filesuffix":".cache","directorylevel":1,"embedexpiry":10}`); err != nil { log.println(err) } if othercache, err = cache.newcache("file", `{"cachepath":".cache/othercache","filesuffix":".cache","directorylevel":

linq - List.OrderBy returns a collection of empty strings -

i have collection string date values of empty strings (""). when use orderby clause, following statement thelist = thelist.orderby(function(x) x.age).tolist() returns empty string collection. however, if use orderbydescending operator, result correctly ordered descending data values. sample date values "2014-10-31 00:00:00.000", "2014-09-30 00:00:00.000", "2014-11-30 00:00:00.000", "", "2014-08-31 00:00:00.000". what problem please? thank you, piyush varma my first instinct if x.billedthru ever shorter 10 characters, see behavior. return rows if try this: dim returncollection list(of fundedaccountsdetail) = new list(of fundedaccountsdetail) select case sortby case "billedthru" if ascending = "asc" returncollection = reportcollection.orderby(function(x) x.billedthru).tolist() elseif ascending = "desc" returncollection = reportcollection.orderbydesc

c# - How to fix a debug configuration fail with Windows App certification kit? -

Image
i updated windows phone 8.0 app 8.1 when run windows app cert kit keeps failing failed debug configuration . i gathered project build set debug somewhere can see release build config settings has been set , .xap file shows release version. is there build configuration setting may have missed causing error? i've set build config release here: and in project properties : you need build "release" version of .xap not change settings in configuration manager. change release clicking drop down menu next green arrow, might need change arm well. after compile can store -> launch windows app certification kit

JQuery accordion won't bring back default panel -

this not jquery ui accordion, show/hide script. list of links supposed toggle divs corresponding anchors. my problem first link , initial div, displays default, won't come after has been hidden. javascript: $('.active').click(function() { return false; }); $('.ready').click(function() { var accordionid = $(this).attr("href"); // links either 'active' or 'ready' $('.active').removeclass('active').addclass('ready'); $(this).removeclass('ready').addclass('active'); // panels have class 'showing' if display $('.showing').slidetoggle().removeclass('showing'); $(accordionid).slidetoggle().addclass('showing'); return false; }); i have fiddle here shows problem: http://jsfiddle.net/g0e00l2p/ i'd expect script fire on links have 'ready' class. reason fires on links have 'active' class. since weren

performance - AngularJS, ng-model slow because other watchers are slow -

i have simple ng-model example: <input type="checkbox" ng-model="active" /> and have watcher like: <pre>status = <span ng-bind="value()"></span></pre> the watcher slow because whatever reason , makes above form element react slow makes interface clumsy. of course have make effort in optimise bellow bind element point don't need element fast, need form element fast because 1 user putting attention. so how can make ng-model have priority on other watcher? to reproduce issue can visit this plunker . check app.js can see method value() has been artificially delayed, can manipulate delay increase effect.

ios - UISplitViewController inside tab bar -

Image
i have app has login screen , when user logs in, tab bar controller pushed. have views benefit fact apple allows using split view controller in ios devices, preparing implement when read uisplitviewcontroller must root view controller. wondering if possible make view in 1 of tabs become master-detail view using uisplitviewcontroller or need implement manually? in case not possible show split view tab, pushed tab bar controller? (e.g. user taps row in table view , master-detail view appears). you can embed uisplitviewcontroller inside uitabbarcontroller . i've done app released on app store. has 3 tabs , each 1 split view controller. just drag out tab bar controller storyboard, delete 2 controllers added, drag out split view controller. control drag tab bar controller split view controller , select "view controllers" relationship segue. on xcode versions less xcode 8, may see black or white bars @ top , bottom of split view controller in interface build

mysql - Use value from first select for second select in union? -

lets i've got following table familiar example. +----------------------------------+ | tags | +--------+-------------+-----------+ | tag_id | tag_name | parent_id | +--------+-------------+-----------+ | 1 | programming | null | | 2 | php | 1 | | 3 | class | 2 | | 4 | object | 2 | | 5 | method | 3 | +--------+-------------+-----------+ i'm trying devise query selects associated parent_id , tag_name based on value of initial select statement. something this: select * tags child child.tag_name = 'object' union select * tags parent parent.parent_id = child.parent_id i need able return combined rows both these queries why i'm using union . the expected result should be: +--------+-------------+-----------+ | tag_id | tag_name | parent_id | +--------+-------------+-----------+ | 2 | php | 1 | | 4 | object

lotus domino - JavaAgent" java.lang.NoClassDefFoundError: de.bea.domingo.DNotesFactory -

Image
i'm try debuging follownig java agent in domino designer public class javaagent extends agentbase { public void notesmain() { dnotesfactory factory = dnotesfactory.getinstance(); dsession session = factory.getsession(); ddatabase database; try { database = session.getdatabase("", "names.nsf"); dview view = database.getview("($users)"); iterator entries = view.getallentries(); while (entries.hasnext()) { dviewentry entry = (dviewentry) entries.next(); system.out.println(entry.getcolumnvalues().get(0)); } } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } } but following exception javaagent" java.lang.noclassdeffounderror: de.bea.domingo.dnotesfactory java.lang.noclassdeffounderror runtime error . means, domingo-1

c# - Visual Studio 2010:one or more solutions were not loaded correctly Windows 8 -

i copied project memory stick work machine. every time try open project have message box saying: one or more solutions not loaded correctly,please see output window detail when close message box, have name of project (unavailable)! when try close visual studio, file called name.sou opens automatically!! thought main reason, deleted file , tried reopen again, keeps showing me same message! i have project works on usb stick, error generates every time try copy project file ! i know question asked, there no clear solution problem! can me please or guides me of solve issue. check if have necessary sdk's. for me issue the project type not supported installation. related missing framework installation.

Is Cordova Bluetooth plugin + HTML5 a good platform for Bluetooth development? -

in evaluating platform bluetooth, , html5, research indicates there cordova plugin, can interface bluetooth devices. so, in essence, using html5 1 use detect bluetooth devices , sync them data, using these plugins. instance, if 1 needed picture downloaded bluetooth device, done after detecting device using html5. or, instance 1 gps coordinates using such connectivity blutooth device. html5 code resides on either mobile device, , handshakes bluetooth device data, using cordova bluetooth plugin. architecture workable in real world? cordova workable solution problem. totally depends on needs. if use features bluetooth plugin of cordova provides, work app. when in future app need features of bluetooth plugin not provide, hard use them because need create own plugin or request new features developers of plugin.

linux - Lowercase all text except xml tags -

i've got large number of tagged strings: watch <team>philly's</team> game what's on <time>wednesday night 8 o'clock</time> i lowercase text except xml tags. i.e. watch <team>philly's</team> game what's on <time>wednesday night 8 o'clock</time> i can lower case text using awk: awk '{print tolower($0)}' file.txt but have no idea how avoid xml tags. languages/tools welcome. this sed (gnu) one-liner may help: sed -r 's/([^<>]*)($|<)/\l\1\e\2/g' with example: kent$ echo "watch <team>philly's</team> game what's on <time>wednesday night 8 o'clock</time>"|sed -r 's/([^<>]*)($|<)/\l\1\e\2/g' watch <team>philly's</team> game what's on <time>wednesday night 8 o'clock</time>

Dynamic Allocation of memory c++ performance improvements -

good night i'm learning c++ scientific code development. differently of learning strategy used in python , matlab, i'm trying learn c++ in old , deep way (using book ref[1]). i'm struggling understand pointers , dynamic memory allocation. i came across exercise , doubts appeared. exercise simple 2x2 matrix multiplication. code: #include<iostream> //perform c[2][2] = a[2][2]*b[2][2] using dynamic memory allocation int main(){ //declaring length of matrices int row,col; row = 2; col = 2; //allocating memory matrice [heap ?] double** a, **b, **c; = new double* [row]; b = new double* [row]; c = new double* [row]; (int i=0; i<row; ++i){ a[i] = new double [col]; b[i] = new double [col]; c[i] = new double [col]; } //performing calculation (int i=0; i<2; ++i){ (int j=0; j<2; ++j){ a[i][j] += 10; b[i][j] += 20; c[i][j] += a[i][j]*b[i][

ios - Proper way to parse with SwiftyJSON -

i'm using swityjson iterate through json data , parse it. it's working fine, make sure i'm using syntax correctly , efficiently. please review code below: if let itemdict = json[0]["artists"].dictionaryvalue { item in itemdict { if let artist: dictionary? = item.1.dictionaryvalue { // artist id if let artistid = artist?["id"] { if artistid.stringvalue != nil { // add value object } } // title if let title = artist?["title"] { if title.stringvalue != nil { // add value object } } // subtitle

python 2.7 - Matplotlib scatter plot different colors in legend and plot -

Image
i have scatter plot of multiple y-values same x-value, in matplotlib (python 2.7). there different colors plotted y-values. see plot below. now, here code: import numpy np import pandas pd import matplotlib.pyplot plt import pylab pl import matplotlib.cm cm # generate test x, y , y_error values: df2a = pd.dataframe(np.random.rand(10,5), columns = list('abcde')) df2a.insert(0,'x_var_plot',range(1,df2a.shape[0]+1)) df2a_err = pd.dataframe(np.random.rand(df2a.shape[0],df2a.shape[1]-1), columns = df2a.columns.tolist()[1:]) df2a_err.insert(0,'x_var_plot',range(1,df2a.shape[0]+1)) fig = plt.figure(1) ax = fig.add_subplot(111) ![errorbars problem][1] colors = iter(cm.rainbow(np.linspace(0, 1, df2a.shape[1]))) # generate plot: col in df2a.columns.values.tolist()[1:]: ax.errorbar(df2a['x_var_plot'], df2a[col], yerr=df2a_err[col], fmt='o') ax.scatter(df2a['x_var_plot'], df2a[col], color=next(colors), label=col) ax.legend(loc=&

c++ cli - How to use user.config in c++ cli -

i tired of googling how use user.config instead of app.config in managed c++ application. found c# , can't figurate out how translate c++ (properties namespace not exist) anybody can put me in way learn that? need know how create, read , write user.config file. thank you follow steps , work desired: 1 - add reference system.configuration 2 - add new item > visual c++ > utility > configuration file 3 - open app.config , add settings example: <configuration> <appsettings> <add key="greeting" value="hallo world!" /> </appsettings> </configuration> 4 - copy app.config output folder in post build event: goto project properties > configuration properties > build events > post-build events > command line , add this: copy app.config "$(targetpath).config" 5 - read settings: string^ greeting = configurationmanager::appsettings["greeting"]; console::wr

javascript - Get notified when location of opened popup window changed -

i'm implementing external oauth authentication @ webiste. on button click i'm opening popup let's facebook auth page. need know when authentication completed read oauth token , close popup. click: function () { var popup = window.open(url, title, '<options>'); popup.onload = function () { //1. if url contains token - finish oauth authentication //2. close popup //but 'onload' doesn't work external domains } return false; }, when i'm trying access using polling technique i'm hetting following security error: uncaught securityerror: blocked frame origin " https://some_app_host_not_the_same_as_following.com " accessing frame origin " https://some_auth_host_which_works_with_facebook.com ". protocols, domains, , ports must match. how can achieve this? if have control on contents of pop-up, handle window's unload event there , notify original window via opene

matlab - determine index and value of first negative peak -

i solving funcion uses moving average filter remove noise. how can determine index , value of first , second negative peak after apply filter input data? use findpeaks on negative of data, extract first 2 elements extract first , second indices of negative peaks located. supposing signal stored in f , do: [peaks, locs] = findpeaks(-f); p = peaks(1:2); loc = locs(1:2); findpeaks works finding local maxima. if want find local minima (i.e. negative peaks), apply findpeaks negative of signal local minima become local maxima, apply same algorithm. loc contain first 2 locations of negative peaks are, while p determine negative peak amplitudes. however, you'll need play around input parameters findpeaks , instead of using default ones suit data, should enough started. sidenote if don't have access findpeaks , take @ this post wrote find peaks fft data . data different, overall logic same. however, finds all peaks - both local maxima , minima. if

android viewpager: reset adjacent fragment's scroll position -

i'm using viewpager , slidingtablayout implementing tabs in activity. activity has 5 fragments. i'm trying achieve when user starts scrolling switch tabs, need reset scrolly of new fragment (that in memory due viewpager caching becoming visible) value. i tried using fragment.onresume not work. using viewpager.onpagechangelistener.onpagescrollstatechanged, i'm able capture when user starts scrolling left/right, how access new fragment becoming visible can reset it's scroll position? you can use viewpager.pagetransformer take coming page whatever wanted, : @override public void transformpage(view page, float position) { page.setscrolly(100); ... } this question , answers tell details.

assembly - Stack allocations with a negative offset in a recursive function of more than 4 parameters -

okay, have function takes 5 arguments passed main. $a0-$a3 , $t0 # prologue: set stack , frame poiters search addiu $sp, $sp, -28 # allocate stack space -- 28 needed here sw $fp, 0($sp) # save caller's frame pointer sw $ra, 4($sp) # save return address addi $fp, $sp, 24 # setup search frame pointer # preserve $a register arguments sw $a0, 0($sp) # addr of element in array sw $a1, 4($sp) # searchvalue sw $a2, 8($sp) # indexleft sw $a3, 12($sp) # indexright # 5th argument lw $s5, 44($sp) # level = 28 + 16 i how works. however, main doesn't store $t0 in 16($sp). instead stores $t0 in -4($sp). what mean? set offset in order load value stored $t0 onto stack $s5 register? i'm leaning towards 24($sp) (28 + (-4)) i'm not sure. this recursive function, want make sure each register loads proper values every time function

apache - Website Redirect on IIS -

on apache server, can website redirect placing .htaccess file on root folder following content: rewriteengine on rewriterule ^(.*)$ http://www.newdomain.com/$1 [r=permanent,l] is possible same way (placing file on root folder redirect) on iis? yes, add web.config file in place of .htaccess file. web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="redirectrule" stopprocessing="true"> <match url="^(.*)$" /> <action type="redirect" url="http://www.newdomain.com/{r:1}" /> </rule> </rules> </rewrite> </system.webserver> </configuration> more info here: http://www.iis.net/downloads/microsoft/url-rewrite

ajax - Preventing calls to php scripts from a localhost or from another domain -

i have website php scripts, of them called in ajax. i'd prevent site malicious users try calling , using scripts site, or dummy localhost site. i thought filtering domain name, tools easyphp , virtual host managers, can run local website tricking "domain" name. i thought filtering ip adress of caller, guess if can trick "domain" name, can trick localhost ip. so, how may have security work fine ? what referring called cross site request forgery . calling 1 of scripts website forbidden same-origin policy . taking consideration , fact ajax request can contain few headers without consent of server via cross-origin resource sharing , can send custom http header , checking header on server side, php. if header missing, request not coming own application. you require each client send unique token each request in order fetch data. common used token method called synchronizer token pattern . sorry long list of links included in answer, consider

java - Many-to-Many Relationship in Hibernate with Extra Column -

i have database stucture this. user access control in application. usergroup ========== id (pk) code name hakakses ========== id(pk) usergroup_id (fk) akses_id (fk) action_create action_read action_update action_delete akses ========== id(pk) code and make hibernate annotation this @entity @table(name = "[master].[usergroup]") public class usergroup implements serializable{ @id @generatedvalue(strategy = generationtype.auto) private long id; @column(unique = true, length = 10) private string kode; private string nama; @onetomany(mappedby = "usergroup") private set<hakakses> hakaksesset; } @entity @table(name = "[master].[hakakses]") public class hakakses implements serializable { @id @generatedvalue(strategy = generationtype.auto) private long id; @manytoone @joincolumn(name = "usergroup_id", nullable = false) private usergroup usergroup; @many

STL Decomposition Error in R -

i have problem here. have imported data set r studio. when wanted stl decomposition, error came out "only univariate series allowed". how can overcome problem? this code convert data time series data. data<-ts(ts,start=c(1970,1),end=c(1980,12),frequency=12) jan feb mar apr may jun jul aug sep 1970 324.60 325.57 326.55 327.80 327.80 327.54 326.28 324.63 323.12 1971 326.12 326.61 327.16 327.92 329.14 328.80 327.52 325.62 323.61 1972 326.93 327.83 327.95 329.91 330.22 329.25 328.11 326.39 324.97 1973 328.73 329.69 330.47 331.69 332.65 332.24 331.03 329.36 327.60 1974 329.45 330.89 331.63 332.85 333.28 332.47 331.34 329.53 327.57 1975 330.45 330.97 331.64 332.87 333.61 333.55 331.90 330.05 328.58 1976 331.63 332.46 333.36 334.45 334.82 334.32 333.05 330.87 329.24 1977 332.81 333.23 334.55 335.82 336.44 335.99 334.65 332.41 331.32 1978 334.66 335.07 336.33 337.39 337.65 337.57 336.25 334.39 332.44 1979 335.89 336.44 337.63 338.54 339.06 33

html input names into an xml document using PHP -

this might simple question, i'm new php. need use html input tags same name , write entries xml document using php. of found uses same name in conjunction radio buttons, need these text input. agree array easiest way that, can't make array go xml file. want have multiple inputs of same name go xml because don't know how many authors users want put in xml. used clonenode method create more available entries. tried change name of input elements, doesn't seem work, , think easier of input post xml file. form html. <form action="generate.php" method="post" name="book"> <div id="wrap"> <p id="author0">author's first name: <input class="firstinitial" type="text" name="firstinitial[]" placeholder="f" autocomplete="off" maxlength="1" size="1" ><input class="firstname" ty

Haskell standard function (or simple composition) for "mjoin"? -

this seems long shot, i've had need following: mjoin :: (monoid b, monad m) => m b -> m b -> m b mjoin b = a' <- b' <- b return $ mappend a' b' the example use this: > mjoin (just [1,2,3]) (just [4, 5, 6]) [1,2,3,4,5,6] > mjoin (just [1,2,3]) nothing nothing > mjoin nothing (just [4, 5, 6]) nothing in other words, if either parameters nothing , return nothing . else, return just , appended values. is there standard function or simpler formulation, perhaps >>= ? perhaps this: mjoin :: (monoid b, monad m) => m b -> m b -> m b mjoin = liftm2 mappend

html - How do I create background image and add text over it -

to start very new bootstrap wanted similar example: text on background image inside of bootstrap framework. have tried creating div inside container below navbar seems put white background behind text covering image behind... can see code here: jsfiddle: my code . or follows: css body { margin-top: 50px; /* required margin .navbar-fixed-top. remove if using .navbar-static-top. change if height of navigation changes. */ } @import url(http://fonts.googleapis.com/css?family=oswald:700); html { background: url(http://3.bp.blogspot.com/_6r-moi0ouo0/s6q3vodcqi/aaaaaaaab5a/uycl8dcr92a/s1600/nyc15brooklynbridge02.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; font-family: 'oswald', sans-serif; } h1 { color: #fff; text-align: center; font-size: 120px; text-transform: uppercase; } span { font-size: 130px; color: transparent; text-shadow: 0 0 10px #fff; } html

ios - Understanding NSAutoreleasePool -

i have app gets memory warning when using camera on iphone 4s. scale image before use it. + (uiimage*)simpleimagewithimage:(uiimage*)image scaledtosize:(cgsize)newsize { // create graphics image context uigraphicsbeginimagecontext(newsize); // tell old image draw in new context, desired // new size [image drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; // new image context uiimage* newimage = uigraphicsgetimagefromcurrentimagecontext(); // end context uigraphicsendimagecontext(); // return new image. return newimage; } i read should use nsautoreleasepool here http://wiresareobsolete.com/2010/08/uiimagepickercontroller/ so modified code this: + (uiimage*)simpleimagewithimage:(uiimage*)image scaledtosize:(cgsize)newsize { //http://wiresareobsolete.com/2010/08/uiimagepickercontroller/ nsautoreleasepool *pool = [[nsautoreleasepool alloc] init]; // create graphics image context uigraphicsbeginimagecontext(newsize); // tell old image draw in new context, desire

jquery - How look up JSON object in Handlebar expressions -

i'm using handlebars , trying use post's userid find user's username , pic; i'm using userid placeholder correct expression. i've tried several ways data json files instead of having inline, haven't gotten right. {{#posts}} <div class="post"> <div class="avatar"> <img src="{{userid}}"> </div> <div class="post-content"> <a href="#">{{userid}}</a> {{content}} </div> <div class="post-comments"> {{#comments}} <div class="comment"> <div class="avatar"> <img src="{{userid}}"> </div> <a href="#">{{userid}}</a> {{content}} </div> {{/comments}} <input type="text" name="comment" placeholder="post

java - jar edit and re-compile in simple way -

Image
i have jar file called screencapture.jar i use http://jd.benow.ca/ in there. have downloaded jd-gui this shows me i can see screencapture.class file. want edit 2 lines here thread.sleep(15000l); thread.sleep(60000l); and driver.manage().window().setsize(new dimension(1024, 768)); driver.manage().window().setsize(new dimension(1200, 800)); but file not editable. my question is, how edit it? how decompile can edit , recompile it. can re-upload jar file , gets normal? btw, know nothing java, , don't have special application/software installed on machine follow these steps: create eclipse project add jar ad dependency project create new class named screencapture.java in package screencapture. copy whole source jd view screenshot of u attached here. change code u want. build project check bin folder of eclipse project . have new compiled .class file. open jar in winrar , copy .class file bin folder jar. and done.

how to use varnish cache with set-cookie named mp3list and phpsessionid -

i new php , interested use varnish improve site performance.. i installed varnish latest version : 4.0.2 varnish http/1.1 200 ok date: sat, 06 dec 2014 07:24:47 gmt server: apache/2.2.29 (unix) mod_ssl/2.2.29 openssl/1.0.1e-fips mod_bwlimited/1.4 x-powered-by: php/5.4.34 expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache set-cookie: phpsessid=86dc704d405a80d0c012de043cd9408b; path=/ set-cookie: mp3list=wdvmg2g4; expires=tue, 03-dec-2024 07:24:47 gmt vary: accept-encoding content-type: text/html x-varnish: 2 age: 0 via: 1.1 varnish-v4 connection: keep-alive i use cookie named ( mp3list , phpsessionid) cant cache pages,, i used vcl $sub vcl_recv { call normalize_req_url; set req.http.cookie = regsub(req.http.cookie, "^;\s*", ""); # happens before check if have in cache already. # # typically clean request here, removing cookies don't need, # rewriting request, etc.