Posts

Showing posts from June, 2015

inheritance - Is there a simple way to generically parse data from strings for child class properties of differing types in C#? -

i have base class abstract public class containerclass { protected containerclass () { // stuff } virtual protected void parsedata() { // stuff i'm mentioning later } } and child classes public class childclassone : containerclass { public childclassone () : base () { var1s = "99"; var2s = "88.3"; var3s = "2015-04-22t15:55:25.2625065-07:00"; } public int var1 {get; protected set;} public double var2 {get; protected set;} public datetime var3 {get; protected set;} public string var1s {get; protected set;} public string var2s {get; protected set;} public string var3s {get; protected set;} } and public class childclasstwo : containerclass { public childclasstwo () : base () { var1s = "99.22"; var2s = "88.3"; var3s = "43.44"; } public double var1 {get; protected set;} public double var

python - How to check if GPU memory is available using PyOpenCL -

i know if there way check how gpu memory available before function uses it. have code uses 1.5 gb of gpu memory or more, , if else using gpu when program wants use it, memoryerror exception or similar. i implement sort of code can check see if gpu has enough memory available, , if does, go ahead , run, if not, wait until available. (preferably, check before trying use gpu rather using try-except loop , retrying if fails) i checked pyopencl documentation see if there relevant under device_info , couldn't find actual descriptions. this not possible, , limitation of opencl, not pyopencl. see here . on nvidia devices, can use nvidia-ml-py . can this: from pynvml import * nvmlinit() in range(nvmldevicegetcount()): handle = nvmldevicegethandlebyindex(i) meminfo = nvmldevicegetmemoryinfo(handle) print("%s: %0.1f mb free, %0.1f mb used, %0.1f mb total" % ( nvmldevicegetname(handle), meminfo.free/1024.**2, meminfo.used/1024.**2,

ceph gateway not working -

i've deployed 6 nodes ceph storage cluster + 1 admin & 1 monitor. seems fine. i've created gateway node , appears fine when started ceph-radosgw process: [ceph@gwy001iad ~]$ sudo /etc/init.d/ceph-radosgw status /bin/radosgw running. but i'm not able use rados or rados-admin cmd on it. [ceph@gwy001iad ~]$ sudo radosgw-admin user create --uid="testuser" --display-name="first user" 2015-04-22 16:22:12.706227 7f6579876880 -1 monclient(hunting): error: missing keyring, cannot use cephx authentication 2015-04-22 16:22:12.706234 7f6579876880 0 librados: client.admin initialization error (2) no such file or directory couldn't init storage provider [ceph@gwy001iad ~]$ rados lspools 2015-04-22 16:37:57.504032 7fb5dcb837c0 -1 monclient(hunting): error: missing keyring, cannot use cephx authentication 2015-04-22 16:37:57.504038 7fb5dcb837c0 0 librados: client.admin initialization error (2) no such file or directory couldn't connect cluster

c# - AutoFixture and fluent Moq syntax -

i've been using moq while, , brevity more not express setups using fluent syntax of mock.of ... var foo = mock.of<ifoo>(f => f.method(it.isany<string>()) == 7 && f.property == "hi"); var sut = new whatever(foo); recently, i've started playing around autofixture , can't seem find equivalent syntax expressing multiple setups @ once. understand can express same thing using freeze ... var foo = fixture.freeze<mock<ifoo>>(); foo.setup(f => f.method(it.isany<string>()).returns(7); foo.setup(f => f.property).returns("hi"); var sut = fixture.create<whatever>(); ...but if @ possible, i'd benefits of automocking, , keep brevity of fluent moq setups. stylistic arguments aside, autofixture expose way me express setups fluently? if not, there optimization can use make autofixture setups more terse? you create mock using moq's fluent api, , inject fixture: var foo = mock.of<ifoo>

positioning starting location of Android Virtual Device -

i trying position emulated phone in android studio virtual device. launching nexus s api 21 virtual device, places emulation @ top of top of screen , i'm unable windows frame move emulation or minimize device. fixed @ top. have tried modify file “emulator-user.ini” simulation . can change window’s. y location lets 530. when emulator graphics becomes visible see on monitor @ assume y 500 location quick flash , shifts top of screen y equals 0 , unable position device. there way set starting location? you can resize android emulator connecting via telnet : $ adb devices list of devices attached emulator-5560 device $ telnet localhost 5560 connected localhost. escape character '^]'. android console: type 'help' list of commands ok window scale 0.75 ok

c++ how do you store a full string into a string array using getline? -

after gets first string , first double program doesn't other strings. for (int = 0; i< num_movies; i++) { cout << "enter name of movie: "; getline(cin, names[i]); cout << "how did " << names[i] << " earn <in millions>: "; cin >> earnings[i]; cout << endl; } the second time call getline reading newline character because cin >> not discard newline characters after value has read. so end in cycle of reading bad data. try this: getline(cin >> std::ws, names[i]);

html - CSS positioning not working in the code editor -

Image
i have simple problem. want navigation stay on top. know codes should be: position: fixed; top: 0; left: 0; but problem is,whenever i'm inserting in dev mode(where write codes), doesn't change, in inspect element, working. question supposed use(class name or id or whatever suggest) can edit code. although question not clear me, think answers question: give nav bar id in html: <div id='nav-bar'></div> <!-- or <navigation> or <header> or whatever --> in css #nav-bar { position: fixed; top: 0; left: 0; }

angularjs - on page redirect, Angular directive's event listener misses jQuery event trigger -

tl;dr i need angular linking function occur before jquery click event triggered on page redirect. i have angular directive waits jquery click event in linking function: // link: function(scope) { angular.element('#parent-selector').on('click', '#buttonid') { // force digest since looking outside of angular scope.$apply(function() { // stuff looks outside of angular }); } } my goal make stuff happen. when click button, happen, , makes me happy. can click again , again , again, , stuff happens; can reload page , click button, , stuff still happens, , sufficiently satisfied. well, have different button in different view different url 1 triggers click event lives. when button clicked, redirects view angular directive , jquery click event. upon redirect, calls jquery click event trigger functionality desire, no avail. sad. // along these lines $('#buttonid').trigger('click');

c# - Invisible constructors, despite use of public access modifier? -

i wrote class multiple overloads, when attempt utilise them outside class, default constructor can used. otherwise receive error stating no such constructor exists. public module()//default module class { code = "undefined"; title = "undefined"; credits = 0; mark = 0; examweighting = 0; exammark = 0; courseworknumber = 1; term = "ay"; coursework1name = "undefined"; coursework1type = "undefined"; coursework1weight = 1; coursework1mark = 0; } public module(string code, string title, int credits, string moduleterm, double exweight, double exmark, string cw1name, string cw1type, double cw1weight, double cw1mark) { code = code; title = title; credits= credits; mark = 0; examweighting = exweight;

stata - How to see tabulate/table/display of frequency that different groups take on values of a variable -

using stata, suppose have data: clear set more off input /// id str5 value 1 fox 1 ox 1 cow 2 fox 2 fox 3 ox 3 fox 3 cow 4 cow 4 ox end as in previous answer , if 1 wants determine within group if values same, 1 can use: bysort id (value) : gen onevalue = value[1] == value[_n] my question relates this, takes 1 step further. want know frequencies of combinations of value id takes on. not want consider frequency or order within id - care if appears @ least once. may little confusing, illustrate, want know following: there 3 different groups occur in data: a) fox, ox, cow , b) fox , , c) cow, ox . note ids 1 , 3 both belong group a , id 2 belongs group b , , id 4 belongs group c . combination freq fox, ox, cow 2 fox 1 cow, ox 1 i not need in exact format, knowing information helpful me. there simple way accomplish task? best thought of involves creating bunch of new variables indicators whether element of va

tfs2013 - Tooltip for dropdown list items in work item definition in TFS -

i customizing work item in tfs. 1 of fields drop down field few list items. <field name="test" refname="name.test" type="string" reportable="dimension"> <helptext>cost center billed task</helptext> <allowedvalues expanditems="true"> <listitem value="001"> <listitem value="002"> <listitem value="003"> </allowedvalues> <required /> </field> i want give tool tip each of list item. example, default list item 001, tooltip shows 001, want customize it, "this item 001" etc. tried setting text each list item, gave validation error. not possible on tfs? this not possible do. you put link wiki page explains list next it.

android - Start app on first boot before keyguard (rooted phone) -

i'm trying start app upon first boot of device before keyguard appears. need ensure first thing user sees after boot animation (which i've changed) app. app 3 screens of text in fullscreen mode next button in between them. i realize cases, terrible user experience. however, phones we're shipping have specific purpose , because of need meet following criteria: my app needs first thing user sees (after boot animation of course) when take phone out of box , power on first time. after first boot, phone should function normal (i.e keyguard should appear upon bootup instead of app). this needs work lollipop since that's android version we're shipping. i can modify android framework if needed, solution don't have preferred. my (failed) approach create app starts upon boot. have app dismiss keyguard first thing does. the problem found approach keyguard code called before app initialization code user sees keyguard briefly , sees app. a possible solut

c# - Code First Complex Type Or Foreign Key Relationship? -

i'm writing mvc5 application ef6 allows users enter job timesheets, job notes , email customer update. i want database structure compose of 3 tables (timers, jobnotes , emails). can have 3 models this; [table("timers")] public partial class timermodel { public int id { get; set; } public string user { get; set; } ...etc public virtual customeremailmodel customeremail { get; set; } } [table("jobnotes")] public partial class jobnotemodel { public int id { get; set; } [column("username")] public string user { get; set; } ...etc public virtual customeremailmodel customeremail { get; set; } } [complextype] public partial class customeremailmodel { [display(name = "email customer?")] public bool sendemail { get; set; } [datatype(datatype.emailaddress)] public string { get; set; } public string subject { get; set; } [datatype(datatype.multilinetext)] public string body {

selenium webdriver - Select an element from drop-down list using java -

i wondering how select element after found in ddl (drop-down list). function can find element failed select it; tried click didn't work. thanks code is: public static void selectguestcountry() { webelement droplist = driver.findelement(by.classname("sboptions")); list<webelement> alloptions = droplist.findelements(by.tagname("a")); system.out.println("total options in list --> " + alloptions.size()); (int i=0;i<alloptions.size();i++ ) { //system.out.println("++> " + alloptions.get(i).getattribute("text")); if(alloptions.get(i).getattribute("text").equals("france")) { system.out.println("++++>" + alloptions.get(i).getattribute("text")); **alloptions.get(i).click();**// doesn't select country break; } } ----------------------------

List of plugins was not loaded android studio -

Image
i'm trying install plugin in android studio when click browse respository shows dialog anyone knows how fix this? check permissions on /root/.androidstudio confirm can create directory plugins. simple way modify permissions user(u), group(g) , other(o) command line: chmod -r ugo+rw /root/.androidstudio/

regex - Delete spaces, commas, colon, semicolon with regexp -

i trying print number of words in following txt ignoring special characters =,;:'. function works, examples have found here not working properly, i've tried. the txt is: select name v$database; select serial# db4sql; clear select (length (txt) - length(regexp_replace(txt, '[0-9\. ,]+$','')) i trying print number of words in following txt ignoring special characters =,;:'. any make complex ignore punctuations when need count number of words . simple query using regexp_count , [[:blank:]] character class. sql> data as( 2 select q'[select name v$database; select serial# db4sql; clear]' txt 3 dual 4 ) 5 select regexp_count(txt, '[^[:blank:]]+') cnt 6 data 7 / cnt ---------- 9 sql> delete spaces, comas, colon, semicolon regexp ok. if want replace punctuations , return pure alphabets , use [[:punct:]] character class. sql> data as( 2 select q'[select name

apache - redirect domain www links to www-staging on staging server -

so know doable .htaccess, can't seem working. i have staging server: www-staging.mysite.com as production server: www.mysite.com i want edit .htaccess file that, on staging server, every request www.mysite.com changed www-staging.mysite.com . every request on production server should function normal ( www.mysite.com ). in htaccess file of staging server (in document root), add above of other rewrite rules (if there any): rewriteengine on rewritecond %{http_host} ^(www\.)?mysite\.com$ [nc] rewriterule ^(.*)$ http://www-staging.mysite.com/$1 [l,r] this works if staging , production servers separate, 2 different document roots.

signal processing - Ridiculously High frequency resolution common in function generators? -

i checked common commercial high-quality lab function generators , seem provide frequency output upto 50 mhz (not big deal) resolution of 1 uhz ? means, can generate signal both 50000000 hz , 50000000.000001 hz ?? equate time-period difference of 4.00355*10^-22 seconds!!! how can possibly generate pulses high of time-resolution? any idea? they don't. might step through function lookup table double precision step increment. doesn't mean output differ amount above noise floor of system (unless wait very long time).

r - Predictive model decision tree -

i want build predictive model using decision tree classification in r. used code: library(rpart) library(caret) datayesno <- read.csv('datayesno.csv', header=t) summary(datayesno) worktrain <- sample(1:50, 40) worktest <- setdiff(1:50, worktrain) datayesno[worktrain,] datayesno[worktest,] m <- ncol(datayesno) input <- names(datayesno)[1:(m-1)] target <- “yesno” tree <- rpart(yesno~var1+var2+var3+var4+var5, data=datayesno[worktrain, c(input,target)], method="class", parms=list(split="information"), control=rpart.control(usesurrogate=0, maxsurrogate=0)) summary(tree) plot(tree) text(tree) i got 1 root ( var3 ) , 2 leafs ( yes , no ). i'm not sure result. how can confusion matrix, accuracy, sensitivity, , specificity? can them caret package? if use model make predictions on test set, can u

Reading XML repeated tags in sql server -

declare @mainxml xml = '<?xml version="1.0" encoding="utf-8"?> <result> <cash number="10"> <account amt="11.00" status="closed"/> <account amt="12.00" status="closed"/> </cash> <cash number="20"> <account amt="21.00" status="closed"/> <account amt="22.00" status="closed"/> </cash> </result>' i reading data using following query declare @innerxml xml; select @innerxml = t.c.query('<result>{/result/cash}</result>') @mainxml.nodes('result') t(c) select result.claim.value('(./@number)[1]','varchar(max)') c1, result.claim.value('(./@amt)[1]','varchar(max)') c2, result.claim.value('(./@status)[1]','varchar(max)') c3 @innerxml.nodes('

java - Android app force close when executed -

execution of following code crashed. there no error messages. it should open web.java upon button press , creates key-value. mainactivity.java import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; import android.preference.preferencemanager; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.spinner; public class mainactivity extends activity { private button btngo; final spinner page = (spinner)findviewbyid(r.id.txtpage); string pagechoice; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final sharedpreferences sharedpref =preferencemanager.getdefaultsharedpreferences(this); btngo = (button)findviewbyid(r.id.btngo); btngo.setonclicklistener(new onclicklistener() { @over

createFileAtPath, in swift -

i want download files url ( not have direct url ) , save file in local directory different name , extension. for eg, a.jpg but when files save, files damaged , can't open anymore. can me, plz? you can't rename extension. have convert it. here way it: uiimage *myimage = [uiimage imagewithcgimage:imageref]; nsdata *pngdata = uiimagepngrepresentation(myimage); nsdata *jpgdata = uiimagejpegrepresentation(myimage); hope helps!!

C++: new base class,but it can access the derived class's property -

#include <iostream> using namespace std; class animal { public: void breathe() { cout << "breathe!" << endl; } int height; }; class fish : public animal { public: void breathe() { cout << "fish breathe!" << endl; } int weight; }; int main() { animal *p_animal = new animal(); fish *p_fish = (fish *)p_animal; p_fish->breathe(); p_fish->weight = 2; cout << p_fish->weight; //i new animal instance,but why has weight property? int temp; cin >> temp; } some side comments on code. in example, want virtual functions. see modification of code comments : #include <iostream> class animal { public: virtual ~animal() {} // define virtual destructor in case virtual void breathe() const // fonction doesn't modify object { // then, add 'const' @ end std::cout << "breathe!" <&

matlab - how to cut a small portion of image using ginput? -

i have image , want cut small region of image using ginput. got rectangle using following code.how cut image in area? [x1 y1]=ginput(2); [x2 y2]=ginput(2); [x3 y3]=ginput(2); [x4 y4]=ginput(2); assuming want separate maximum rectangular area marked 4 user inputs, image can segmented using following code segment. let me know if not fulfill requirement. img = imread('cameraman.tif'); imshow(img); [x, y] = ginput(4); img2 = img(min(y):max(y),min(x):max(x)); imshow(img2); assuming 2 user clicks required @ top left corner , bottom right corner of intended region segment, above code can modified follows. img = imread('cameraman.tif'); imshow(img); [x, y] = ginput(2); img2 = img(min(y):max(y),min(x):max(x)); imshow(img2);

java - How do you handle duplicates in binary tree? -

this testing part of it, keep getting return of 2 instead of fff. need have implemented on bottom return duplicates. ?handling duplicates not trying prevent them inserting it, have return correct value. system.out.println("\ninsering duplicate key: ..."); tree.insert(2, "fff"); testfind(tree.find(2), 2, "fff"); i need handle duplicates , return "fff" above ^ test code bottom needs further implemented. public v find(k key) { node node = findhelper(key, root); if (node == null) { return null; } else { return (v) node.entry.value; } } public node findhelper(k key, node node) { if (node.entry.key.compareto(key) == 0) { return node; } else if (node.entry.key.compareto(key) > 0) { if (node.leftchild == null) { return null; } else { return findhelper(ke

linux - Who arranges/creates the different segments(stack,heap,code segment, data segment) of a program -

while going through diiferent segments of program, have still doubt creates segments. understanding assembler creates different segments while creating assembly code , when loading virtual memory loader creates virtual address space segments , stores them in virtual memory. please me in understanding it. yes, assembler generates individual segments, specify them in code using labels, instance .data directive tells assembler we've reached data segment.

php - Swiftmailer: Missing space in subject email -

i'm using swiftmailer (v 4.2.2) send emails, , observed when swiftmailer construct email, if has long subject, inserts line breaks in header of mail. subject : lorem ipsum dolor sit amet =?iso-8859-1?q?consect=e9tur?= adipisicing elit the original subject : lorem ipsum dolor sit amet consectétur adipisicing elit when send mail (using mandrill, or php mailer local smtp server), receive mail subject lorem ipsum dolor sit amet consectéturadipisicing elit the space missing, line break inserted in header . i tried solution on thread : removing \r in function gettokenasencodedword() in classes/swift/mime/headers/abstractheader.php , doesn't seem work. does have solution this? thanks in advance. it looks there issue how swiftmailer generating subject line has special characters, , how mandrill's parser handles those. specifically, appears space before line breaks after special character removed mandrill. the reason when subject line header split

ios - Responder Chain in Swift (nil target in UIButton target) -

i have got problem using responder chain in swift. when setup buttons target using nil target like: somebutton.addtarget(nil, action:"addbuttontapped:", forcontrolevents: .touchupinside) the action send responder chain until action handled in controller. far :-) but want intercept action, execute code , relay on controller. cannot find way in swift. in objc task easy guess there should way in swift too. thanks in advance :-) one of co-workers gave me hint recreate selector , send manually again. let selector = selector("somebuttontapped:") let target: anyobject? = self.nextresponder()?.targetforaction(selector, withsender: button) uiapplication.sharedapplication().sendaction(selector, to: target, from: self, forevent: nil) this recreates responder chain , relays new message next responder. i hope find useful.

ios - react native render only part -

i have feed , bottom menu can filter feed. when filter activated feed reloads data api. root render causing menu collapse every time. how can make feed reloads? var main = react.createclass({ getinitialstate: function() { return { reloadfeeddata: false, }; }, reloadfeeddata: function(){ console.log('setting root state') this.setstate({reloadfeeddata:true}); }, renderscene: function(route, nav) { var reload = this.state.reloadfeeddata switch (route.name) { case 'feed': return ( <feed navigator={nav} reloadfeeddata={reload} /> ); default: return ( <feed navigator={nav} reloadfeeddata={reload} /> ); } }, render: function() { console.log('root render'); return ( <view style={styles.container}>

javascript - How to calculate the lower limit of a div and scroll to the next div? -

i'm trying scroll next div when current div came lower limit. i'm using jquery plugin mousewheel. following code have, run animation scrolltop when scroll. not when reaches desired point lower limit. because, div contain lot of text images. this structure html <html> [...] <body> <div id="main"> <div class="item"> [only image] <!-- img? i'm 2px distance next div ok, scrolltop when scroll1 --> </div> <div class="item"> [some text] <!-- mmmm text. ok, let read this.. scroll 1.. scroll 2.. scroll 3.. wait! i'm 40px distance next div ... scrolltop --> </div> <div class="item"> [some text image] <!-- mmmm text image. ok, let read this.. scroll 1.. scroll 2.. scroll 3.. scroll 4... scroll 5.. scroll 6.. wait! i'm 40px distance next div ... scrolltop --> </div> <div class=

hibernate - @MapKeyColumn(name="XXX") is not working -

i using jpa 2.1 hibernate 4.x. found @makkeycolumn not woking. @entity public class department { @id private int id; @onetomany(mappedby = "department") @mapkeycolumn(name = "cub_id") private map<string, employee> employeesbycubicle = new hashmap<>(); public int getid() { return id; } public void setid(int id) { this.id = id; } public map<string, employee> getemployeesbycubicle() { return employeesbycubicle; } public void setemployeesbycubicle(map<string, employee> employeesbycubicle) { this.employeesbycubicle = employeesbycubicle; } } if above code executed, can see following error caused by: org.postgresql.util.psqlexception: error: null value in column "cub_id" violates not-null constraint detail: failing row contains (2, xxxxxx, null, null). but, if omit @mapkeycolumn , it's working. can let me know why it's not working whe

java - Android: set color programatically from XML color constants -

trying set color defined in res/values/colors.xml object, <?xml version="1.0" encoding="utf-8"?> <resources> <drawable name="listviewselected">@android:color/holo_blue_light</drawable> <drawable name="listviewpressed">@android:color/holo_green_light</drawable> <drawable name="pagertabstrip">#2b3333</drawable> <!--<drawable name="pagertabstrip">#353f3e</drawable>--> <drawable name="tablehead">#ff444444</drawable> </resources> i can not figure out why not working, tried lot of approaches (getresources(), color.parsecolor(), ...) how set color "tablehead" e.g. textview? tv.setbackgroundcolor(????); color entries should this <color name="tablehead">#ff444444</color> and use tv.setbackgroundresource(r.color.tablehead);

php - Variables undefined error in latest version of localhost (vertrigo_230) -

Image
below mentioned php code perfect on vertrigo_222 (and on livehost). now trying upgrade localhost vertrigo_230. i facing following undefined variable error or warning: here code (line # 30 mentioned): <?php ob_start(); session_start(); include_once("php_code/db_connection.php"); if(isset($_request['data'])) $data = $_request['data']; //fetch important information database in variables if($_session['id'] && $_session['pw']) //login must informatiion { if(isset($_request['city_id'])) { if($_request['city_id']) { $city_id = $_request['city_id']; } else { $query = "select * cities user_id = '$_session[id]'"; $c = mysql_query($query) or die(mysql_error()." in query $query"); $city = mysql_fetch_array($c); $city_id = $city['city_id']; } //setting

deployment - How to package shared internal Python module with wheel? -

we have separate python package (shared modules) build ourselves stored in our internal git repository. need use package in python project/application. in development setting, can run pip install -e <module/path> , module can used in other python applications. how tell wheel install these internal shared modules when deploying it?

networking - Client-side prediction & server reconciliation -

i’ve read articles client-side prediction , server reconciliation i'm missing parts, take part of client side prediction don’t understand how reconciliation done. i’ll take these 2 pieces of well-known articles reference: http://www.gabrielgambetta.com/fpm2.html #2. applying client-side prediction again, client can calculate “present” state of game based on last authoritative state sent server, plus inputs server hasn’t processed yet http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/ in effect client invisibly “rewinds , replays” last n frames of local player character movement while holding rest of world fixed ok, take client receives acknowledgement server, how inputs re-applied? can interpret in 2 ways. from client point of view, game loop executed ‘x’ times per second (frames per second) first: non-processed inputs re-applied in same frame, here expression “invisibly rewind , replay “

jquery - How to keep a side menu open -

i'm trying side menu stay open when user clicks 1 of child menu items. example if hover on section 1, section 2 displayed , if click on section 2 section 2 content shown, section 1 still open , doesn't close unless click on section 4, child of section 3. my problem can't stay open when child menu item open. my html <div id="second-menu" class="collapse navbar-collapse menu_two"> <ul class="nav navbar-nav inside-nav"> <li class="sub_menu"> <a href="#">section 1</a> <ul class="sidenav_wrapper"> <li class="sidenav_item sidenavlast"> <a href="#">section 2</a> </li> </ul> </li> <li class="active_sub_menu"> <a href="#">section 3</a> <ul class=

objective c - FSEventsFramework - Dont watch subdirs -

i watching directory fseventsframework on osx 10.7+ , don't want notified of changes in subdirectories , seems doing that. normal? there way prevent this? thanks yes, normal , didn't find way prevent this.

Disabled "Memory Usage" option in VS 2013 Ultimate -

i have installed visual studio 2013 ultimate update 4. create project, compile , start "performance , diagnostics" tool. when starts "memory usage" option disabled. how can enable it? thanks. apparently, "memory usage" option available on windows 8.1 systems. in case, vs2013 runs on windows 7.

javascript - Want to Change Settings in js while it crosses certain position -

Image
i'm creating navbar & i'm using bootstrap this. i'm using padding top 60px while nav transparent here nav code .navbar-default .navbar-nav > li > { padding-top: 60px; } and navbar-brand class .navbar-brand{ padding-top:30px; } when navbar scrolls > 100 looks now want make 30px when scroll > 100 here js code var = $(".navbar-default").offset().top; $(document).on('scroll', function() { if ($(this).scrolltop() > 100) { $('.navbar-default').addclass("scrolled"); $(".navbar-default .navbar-brand").css({ "color": "#a96258" }); } else { $('.navbar-default').removeclass("scrolled"); $(".navbar-default .navbar-brand").css({ "color": "#fff" }); } }); my scrolled class .navbar-default.scrolled{ background-color: #fff; border-bottom: 1px solid #bbb9be; box-shad

asp.net - how can I join two regex into one? -

i have 2 regex need join 1 using regularexpressionattribute in asp.net , not allow multiple instances. how can join following 2 regex one? .*?@(?!.*?\.\.)[^@]+$ [\x00-\x7f] the first 1 checks there not 2 consecutive dots in domain part of email , second regex checks characters ascii i thought might have been easy joining them (.*?@(?!.*?\.\.)[^@]+$)([\x00-\x7f]) not work here link previous post relating problem edit : decorating string property of viewmodel using reglarexpression attribute , gets rendered javascript using unobtrusive therefore has validate using javascript. failed mention in initial post you can use: ^[\x00-\x7f]+?@(?!.*?\.\.)(?=[\x01-\x7f]+$)[^@]+$

python - apt-get /usr/bin/datetime.so wrong ELF class -

i'm trying add repo apt-get bit fails complaining on elf headers sudo add-apt-repository -y ppa:chris-lea/node.js traceback (most recent call last): file "/usr/bin/add-apt-repository", line 11, in <module> softwareproperties.softwareproperties import softwareproperties, shortcut_handler file "/usr/lib/python3/dist-packages/softwareproperties/softwareproperties.py", line 44, in <module> xml.sax.saxutils import escape file "/usr/lib/python3.4/xml/sax/saxutils.py", line 6, in <module> import os, urllib.parse, urllib.request file "/usr/lib/python3.4/urllib/request.py", line 88, in <module> import http.client file "/usr/lib/python3.4/http/client.py", line 69, in <module> import email.parser file "/usr/lib/python3.4/email/parser.py", line 12, in <module> email.feedparser import feedparser, bytesfeedparser file "/usr/lib/python3.4/email/feedparse

configuration - Is is possible create/delete/disable multiple breskpoints once in GDB? -

i create/delete/disable (and other actions breakpoint) multiple breakpoints in 1 command line, such as: b 12 28 30 to create 3 breakpoints @ line 12, 28 , 30. i googled many times, got nothing. the built-in way create multiple breakpoints single command rbreak , isn't applicable you, doesn't allow line numbers. if need reason, can write new command it. might able cli using define , but, if not, can use python write new commands. many other breakpoint commands enable (but not commands -- think, e.g., not cond syntax reasons) take list of breakpoints work on.

c# - Attribute routing and RouteLink -

i define home view <body> <div> <h1>home</h1> @html.routelink("r1", "first", new { user="r1"}) @html.routelink("r2", "second", new { company = "r2" }) </div> </body> and login controller public class logincontroller : controller { // get: login [route("{user}", name = "first")] public actionresult index(string user) { return view(); } [route("{company}", name = "second")] public actionresult index2(string company) { return view(); } } routeconfig public class routeconfig { public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.mapmvcattributeroutes(); routes.maproute( name: &qu

java - Google reflections on Websphere - Could not open url connection -

i'm having project in i'm using google reflections , deploying project on websphere liberty profile. my project has following code, transformer.class location in dependency jar private void bindtransformers(simpleregistry initialcontext) throws exception { reflections reflections = new reflections("no.mypackage.ntrouter"); final set<class<?>> transformerclasses = reflections.gettypesannotatedwith(transformer.class); (class<?> aclass : transformerclasses) { initialcontext.put(aclass.getsimplename(), aclass.newinstance()); } } but reflections not work, getting following error: 2015-04-23 09:34:29,817 [ecutor-thread-5] warn reflections - not create vfs.dir url. ignoring exception , continuing org.reflections.reflectionsexception: not open url connection @ org.reflections.vfs.jarinputdir$1$1.<init>(jarinputdir.java:36) @ org.reflections.vfs.jarinputdir$1.iterator(jarinputdir.java:32)

android - get position in autocompletetextview -

i have 2 autocompletetextviews,in first autocompletetextview getting items server using json,the following response that {"status":"success","clientlist":[{"cid":"1","name":"margi"},{"cid":"2","name":"steven"}],"productboxtype":[{"pbxid":"1","pbxname":"1 dozen","qtyperbox":"12"},{"pbxid":"2","pbxname":"2 dozens","qtyperbox":"24"},{"pbxid":"3","pbxname":"3 dozens","qtyperbox":"36"}]} i able names in first autocomplete , works fine, now issue suppose user select item "margi" , cid 1,so again sending request server , trying productnames of 'margi',and response {"status":"success","clientproduct":[{"pid":"4","na

cannot run condition if-else in django -

i want check if user logged in: {% if userprofile.is_autenticated %} <li><a href="{% url 'kerajinan.views.profile' %}"><i class="fa fa-user"></i>{{ user.get_username }}</a></li> <li><a href="{% url 'django.contrib.auth.views.logout' %}">sign out</a></li> {% else %} <li><a href="{% url 'django.contrib.auth.views.login' %}"><i class="fa fa-lock"></i> login</a></li> {% endif %} but when i'm logged in, uses code: <li><a href="{% url 'django.contrib.auth.views.login' %}"><i class="fa fa-lock"></i> login</a></li> i made custom user model manage users. you need set auth_user_model in settings , can read this more info.

java - Connect to google api -

i have prograammed couple of years now, never made android app before, therefore build.gradle , manifest new me. the app trying make app tests kids on multiplication table. app worked perfectly, tried add function log google , use achivements in google play, can't seem connect google api. i have tried follow tutorial: tutorial , no luck. connectionresult{statuscode=sign_in_failed, resolution=null} whenever try connect. here manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nilsen.anders.multiplication" android:versioncode="2" android:versionname="1.0.1"> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.get_accounts"/> <uses-permission android:name="android.permission.use_credentials"/> <application andr