Posts

Showing posts from April, 2014

python subprocess shouldn't run from within the folder -

i trying use c&c nlp library in mac , uses terminal interface. naturally i'm trying run command python, here's happens: candc:could not open model configuration file reading:models/config turns out candc should not called same directory, , should called outside of binary folder, "bin/candc". how can make work? this code: cmd="candc/bin/candc --models models" subprocess.check_output('{} | tee /dev/stderr'.format( cmd ), shell=true) pass cwd argument desired working directory. for example, if want run bin/candc candc directory: import os cmd="bin/candc --models models" subprocess.check_output('{} | tee /dev/stderr'.format( cmd ), shell=true, cwd=os.path.abspath('candc')) (i'm not sure whether need os.path.abspath. test both , without it.)

create a seq with an ifelse statement in r -

i have column in data frame tracks changes in time. i'm struggling figure out how write ifelse statement create sequence when number (change in time) greater 10, step one. instance, make snippet, here input: input <- c(1,1,1,2,5,2,4,9,11,1,1,15,2,1) here output desire: output <- c(1,1,1,1,1,1,1,1,1,2,2,2,3,3) when there number on 10, next number in vector steps 2 , 3. i've tried doing using ifelse create flag this: ifelse(input>10,1,0) but can't seem put together. appreciated. try cumsum cumsum(c(true,(input>10)[-length(input)])) #[1] 1 1 1 1 1 1 1 1 1 2 2 2 3 3

heroku - MySQL datatime versus timestamp with regards to how time is recorded/displayed -

i noticed in test run mysql> select * enumdecoder; +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ | id | createstamp | modstamp | flag | classname | value | label | abv | sequence | +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ | 1 | 2015-04-22 03:11:17 | 2015-04-22 15:11:18 | 0 | testelementfactory | 1 | null | 1 | 10 | | 2 | 2015-04-22 03:11:17 | 2015-04-22 15:11:18 | 0 | testelementfactory | 2 | null | 2 | 20 | | 3 | 2015-04-22 03:11:17 | 2015-04-22 15:11:18 | 0 | testelementfactory | 3 | null | thre | 30 | | 4 | 2015-04-22 03:11:18 | 2015-04-22 15:11:18 | 0 | null | null | null | null | 0 | +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ the definition of table follows: create

design - Volatile polymorphism (?) in gnu C++ -

i have raw binary dump of assembler split blocks (code, data, ignored, images etc). have walker increments position via virtual ++ operator. if it's in data block, moves 32 bytes, code number of bytes in instruction, ignored moves size of block etc. when reaches end of block, needs "transform" walker type of next block while keeping data, data pointer, block lookup etc. there ways using switch statements, array of objects pointing same base etc wondering if there's better way? somehow transform derived object different object same physical base class? can transform derived object different derived object same physical base class? no, far less of issue you'd expect. if have derived1 first; on stack, makes no sense try change first derived2 . however, there's no real polymorphism happening. polymorphism works magic when have base* second; points @ derived object. , 99% of time, that's going allocated on heap. can create new deriv

mysql - Rails - How to search through multiple tables -

i trying implement search feature go across multiple tables. right have searching functionality each of individual tables in database. as example able search 'title' multiple tables correspond title. 2 tables in example 'acts' , 'attachments'. right have: acts: controller def index if params[:search] @acts = act.search(params[:search]).order('title desc') else @acts = act.all.order('title desc') end end model class act < activerecord::base def self.search(query) where("title ?", "%#{query}%") end end attachments: model: class attachment < activerecord::base def self.search(query) where("title ?", "%#{query}%") end end controller: def index if params[:search] @attachments = attachment.search(params[:search]).order('title desc') else @attachments = attachment.all.order('title desc') end end any appreciated.

c# - How to format a page using a command? -

what im going ask isnt big deal, want know if can format html page before server sends client. here example, source code of aspx page: <tr id='td'><td><table align='right'><tr><td align='right' valign='top'><a class='link' href='theardlist.aspx?f=4'>שאלות על html</a></td></tr><tr><td style='font-size:small;' align='right' valign='middle'>בפורום הזה תוכלו לשאול שאלות על html</td></tr></table></td><td align='right'>1</td><td>all</td></tr><tr id='td'><td><table align='right'><tr><td align='right' valign='top'><a class='link' href='theardlist.aspx?f=5'>שאלות על c#</a></td></tr><tr><td style='font-size:small;' align='right' valign='middle'>בפורום הז

How to achieve automatic width of Button in Android layout -

i have few button listed vertically , need of them have same width, display text inside. basically need width of them wrapped width of largest one. hope explained well. now... have 1 layout working on samsung galaxy s2 (4.1.2), on friend's phone - samsung gt-n7100 (note2) , android 4.4.2 - not working - text not displayed in button. this layout: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:text="word" android:layout_width="wrap_content" android:layout_height="48dp" android:textsize="30sp" android:gravity="center" android:layout_centerhorizontal="true" android:id="@+id/word"/> <textview android:text="14/36\nm: 1" android:layout_widt

continuous integration - Best way to configure jenkins job running on different slaves -

i want run jenkins job on 4 different slaves (windows, linux, solaris, mac). instead of making 4 different jobs want have single job. can use node parameter execute on different slaves. job runs script uses jenkins workspace of slave , few other scripts. script in different folder on each slave, , other required scripts in different folder. have created 4 different jobs each slave , hard-coded jenkins workspace , other required scripts path. is there way can put paths in json-like structure , depending on slave pick paths? have 1 job only. please suggest, in advance! my idea use e.g " execute system groovy script " slave value , use if statement assigne proper path , create parameter visible in environment variables: import hudson.model.computer import hudson.model.stringparametervalue import hudson.model.parametersaction //get slave name def slavename = computer.currentcomputer().getnode().name def path //choose path if(slavename.equals("slave01&q

Build error when compiling java methods in C++ using jni.h -

i'm trying run few methods java class in visual studio c++ environment. got error related createjavavm. would please me find solution? i did following steps. step 1: jdk 1.6 installed under following path: c:\program files\java following 2 sub directories there: jdk1.6.0_45, jre6 step 2: write simple java program. public class sample2 { public static int intmethod(int n) { return n*n; } public static boolean booleanmethod(boolean bool) { return !bool; } } step 3: compile java code: javac sample2.java step 4: create visual studio c++ program. visual c++ clr console application. step 5: add additional dependencies. (jvm.lib , jvm.dll) a) choose project -> properties -> linker -> input -> additional dependencies: jvm.lib b) choose project -> properties -> linker -> input -> delay loaded dlls: jvm.dll step 6: add include directories a) choose project -> properties -> configuration properties -&

Extract Json data from RestFul webservice using Python -

we use bugsplatsoftware.com collect crashes. have restfull web service returns json data. data individual crashes . data behind login/password... i tried following results not expected. import requests requests.auth import httpbasicauth args={'id':11111,'data':0} response=requests.get("https://www.bugsplatsoftware.com/individualcrash",params=args,auth=httpbasicauth("username","password")) data=response.json() response.headers returns following response.headers {'content-length': '10549', 'connection': 'close', 'server': 'apache/2.4.12 (win32) openssl/1.0.1l php/5.5.21', 'x-frame-options': 'sameorigin', 'x-pingback': 'https://www.bugsplatsoftware.com/xmlrpc.php', 'expires': 'thu, 19 nov 1981 08:52:00 gmt', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'x-xss-protection':

python - Initializing a class that consist of many classes in such a way that one of the classes has different attributes -

here classes , relations: http://i.imgur.com/hs5yrzz.png code clarification: class a(object): def __init__(self): self.atr = 1 class b(object): def __init__(self): self.atr = a() class c(object): def __init__(self): self.atr = a() class d(object): def __init__(self): self.atr1 = b() self.atr2 = c() test1 = d() now do if want initialize d in such way a 's self.atr = 2 , , change reflects classes ( b , c ) use a when initialize d like imagine in pseudo code: test2 = d(a.self.atr = 2) so initialize d in such manner a 's self.atr = 2 if want b , c have different properties, required call d, way pass parameters initialization of b , c know do. the parameter can instance of a, attributes care set before inistantiatin b , c: class a(object): def __init__(self, atr=1): self.atr = atr class b(object): def __init__(self, config): self.atr = config class c(object):

oracle11g - SOA Composite not pulling data from query, dealing with latency -

Image
we have oracle soa composite deployed on weblogic 11g. there trigger in mysql database kicks off composite. when runs new entry account name not being populated added additional query account name. have included screenshot of check have query account name. it appears corresponding table not getting updated fast table trigger on. tried putting wait in composite , didn't work. tried wait while loop, hung composite. have suggestions on how handle situation this? thanks, tom this issue composite assignments incorrect , query did not return data.

jsp - Prompt user to select the path for downloading a file java -

how should prompt user select path downloading file in java? currently, have provided default path store files. but, how should allow user select path? using jsp , servlet. once user enters data in jsp , clicks on generate report, user should prompted dialog box asking him/her choose path. the path file downloaded job of client browser, not web application. should write content of file download httpservletresponse . make sure set content type "application/octet-stream" in order prompt user downloading file, regardless of client browser.

android - StaggeredGridLayoutManager returns wrong verticalScrollOffset -

i'm doing same here ( https://github.com/kmshack/android-parallaxheaderviewpager ), recyclerview in tabs. recyclerview in 1 tab has items big height , first 1 not visible under header. @ point call recyclerview's computeverticalscrolloffset() (that calls staggeredgridlayoutmanager's method) , returns wrong values. if change header height make first item visible i'm getting right values. is there known solution/fix this? p.s. use linearlayoutmanager , right values if first item not visible under header i believe error findfirstvisibleposition() , findlastvisibleposition() used in computescrolloffset() function arguments. if use equal row height computeverticalscrolloffset() returns weird numbers. if replace them recyclerview.getchildat(0) , recyclerview.getchildat(recyclerview.getchildcount() - 1) works. so can write our own function: view firstitemview = recyclerview.getchildat(0); view lastitemview = recyclerview.getchildat(recyclerview.getchildc

html - Expanding DIV based on contents -

Image
i have few divs nested within each other display content. 2 inner divs should expand equally in height based on text displayed inside of them text keeps going without div. from reading other user's questions, recommended use overflow: auto; resulted in scrollbars, want height of divs grow if needed. container div has fixed height have tried changing min-height instead, causes taller actual contents inside believe caused them have 100% height. how can fixed? .item { width: 100%; height: 200px; background-color: #5ea8de; margin-top: 10px; border: 2px solid red; } .trigger { width: 20%; height: 100%; background-color: #5ea8de; float: left; padding-left: 15px; border: 2px solid green; } .task { width: 78%; height: 90%; margin-top: 7px; background-color: #1c3c5b; float: left; /*border: 1px solid;*/ border: 2px solid blue; } html: foreach ($tasks $task) { echo "<div

linux - What does pcpu signify and why multiply by 1000? -

i reading calculating cpu usage of process. seconds = utime / hertz total_time = utime + stime if include_dead_children total_time = total_time + cutime + cstime endif seconds = uptime - starttime / hertz pcpu = (total_time * 1000 / hertz) / seconds print: "%cpu" pcpu / 10 "." pcpu % 10 what don't is, 'seconds' algorithm means time computer spent doing operations other interested process, , before it. since, uptime time our computer spent being operational , starttime means time our [interested] process started. then why dividing total_time seconds [time computer spent doing else] pcpu ? doesn't make sense. the standard meanings of variables: # name description 14 utime cpu time spent in user code, measured in jiffies 15 stime cpu time spent in kernel code, measured in jiffies 16 cutime cpu time spent in user code, including time children 17 cstime cpu time spent in kernel code, including time childr

How can I add an image to every row in a TableView with JavaFX using labda expressions? -

i have initialize methode: @fxml private void initialize() { titulocolumna.setcellvaluefactory(celldata -> celldata.getvalue() .tituloproperty()); imagencolumna.setcellvaluefactory(celldata -> celldata.getvalue() .imagenproperty()); // manejar evento dobleclick y enter sobre una receta para mostrar-la tablarecetas.setonmousepressed((event) -> { if (event.isprimarybuttondown() && event.getclickcount() == 2) { manejareditarreceta(); } }); tablarecetas.setonkeypressed((event) -> { if (event.getcode() == keycode.enter) { manejareditarreceta(); } }); } and need change string path of "imagen" of second column image, in order show both, name , image @ same row. the code link lambda expresion: public class listarecetascelda extends tablecell<string,receta>{ private imageview view = new imageview(); @override protected void updateitem

debugging - debugger-x for php how to listen in two locations -

hi , insight in advance. this scenario. using netbeans +8.0 using vagrant w/ centos in vagrant file have 2 locations being mapped (synced_folder) config.vm.synced_folder "../source/www", "/var/www/html/public_html" config.vm.synced_folder "../source/www/source_cron", "/home/html/public_html" when run debugger files associated source_cron skipped though code running them. i figured has to port don't know sure. wanted know if possible listen cron mapping , have do?

mysql - Duplicate Customers with Different Customer Id -

i have customer table customer id auto number , primary key. have table orders customer id foreign key. in customers table 1 customer assigned multiple ids how resolve ? 1 customer can have multiple orders how can assign same customer id multiple orders without manually doing so? i have customer table following fields: 1- customerid - autonumber - primary key 2- buyername 3- addstreet1 4- addstreet2 5- addcity 6- addstate 7- addzipcode 8- addcountry 9- phoneno 10- email 11- company 12- receiptname have table named orders following fields: 1- orderid - primary key 2- customerid 3- purcahsedate 4- fulfillmentcenter 5- saleschannel 6- additionalinfo have relation between customer.customerid , orders.customerid of 1 many. i.e 1 customer can have multiple orders. if data in customer table has same customer twice particular customer gets 2 ids. if run duplicate query , remove customers, orders table change customer id. prime question. thanks

java - Pax-exam 4 no felix() method -

i had been using following code snippet osgi tests in eclipselink project pax exam 3.3.0: @configuration public static option[] config() { return options( repositories("http://repo1.maven.org/maven2"), mavenbundle().groupid("org.osgi").artifactid("org.osgi.compendium").version("4.3.0"), mavenbundle().groupid("org.eclipse.persistence").artifactid("org.eclipse.persistence.asm") .version("2.5.1"), //jaxb api bundle("file:" + plugins_dir + "javax.xml.bind_2.2.12.v201410011542.jar"), //ws api bundle("file:" + plugins_dir + "javax.ws.rs_1.1.1.v20101004-1200.jar"), //eclipselink bundles bundle("file:" + plugins_dir + "org.eclipse.persistence.moxy_2.7.0." + qualifier + ".jar"), bundle("file:" + plug

ionic framework - Google maps centered load failure -

Image
well i'm having problem, load map once , works perfect. second time or once update map not load ok, not centered load when navigating on can see marks made deformed or lost. i have tried several ways solve problem, first , common found use google.maps.event.trigger(map 'resize') did not work , logic, try whenever loading map executed, create new map, same data , focused neither worked me. may way use map. using plugin of camera in application, user takes photo , should detect draw picture , display map. each time view opened, plug of camera, in process of taking , show picture call appropriate functions load map , has me bit tricky loaded have time locked in problem, found solutions serve me browser, device not work. using ionic framework , plugins cordova. controller : .controller("camaractrl", function($scope,$rootscope, camera,$cordovageolocation,$state,$location,$ionicsidemenudelegate) { var posoptions = {timeout: 10000, enablehighaccuracy: fal

Android: How to set the photo selected from gallery to a bitmap -

i asking user access gallery through code listener here: intent photopickerintent = new intent(intent.action_pick); photopickerintent.settype("image/*"); startactivityforresult(photopickerintent, select_photo); however, confused how set variable photo selected. where put code set variable photo selected? thanks :) you can this. @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); // here need check if activity triggers image gallery. // if requestcode match load_image_results value. // if resultcode result_ok , there data know image picked. if (requestcode == load_image_results && resultcode == result_ok && data != null) { // let's read picked image data - uri uri pickedimage = data.getdata(); // let's read picked image path using content resolver string[] filepath = { mediastore.images.

regex - Regular Expressions: Get subdomain and domain -

in nginx, have line states ~^(www\.)(?<sub>.+).(?<domain>.+)$ . how make can subdomain , domain separate? subdomain.example.com. edit: tried ~^(www\.)?(?<sub>)\.?(?<domain>.+)$ , didn't work either. you have escape . ~^(www\.)?(?<sub>.+?)\.(?<domain>.+)$

linux - How to pgrep over ssh, or use pgrep as a larger bash command? -

i'd run pgrep find id of process. works great, except when run larger bash command pgrep match it's parent shell/bash process includes match expression part of command-line. pgrep sensibly excludes own pid results, less sensibly, doesn't seem have option exclude parent process(es). anyone come across , have workaround. update. pgrep -lf java || true works fine, but bash -c "(pgrep -lf java || true)" echo 'bash -c "(pgrep -lf java || true)"' | ssh <host> also identify parent bash process. i'm using pgrep part of larger system, why madness. i ran issue using python's os.system(command) executes command in subshell. pgrep not match itself, match it's parent shell includes pgrep's arguments. i found solution: pgrep -f the-arguments-here[^\[] the [^\[] regex assures not match [ (the beginning of regex itself) , excludes parent shell. example: $ sh -c "pgrep -af the-arguments-h

c++ - Creating a default constructor for a stack -

i working on project class requires implement stack integer use calculator. having problems default constructor , wondering missing. operandstack(int stacksize) { if (stacksize<=0) {cout<<"must positive"<<endl;} this->capacity=capacity; s =new double[stacksize]; t=0; } thanks help. " having problems default constructor , wondering missing." a default constructor takes no parameters, or declares default values of them. cite linked reference documentation default constructors a default constructor constructor can called no arguments (either defined empty parameter list, or default arguments provided every parameter). thus implementation should like: class operandstack { public: operandstack(int stacksize = 10) // ^^^^ declare default value // better use member initializer list, instead of initializing claas // membe

Python 3.4.3 ctypes: Trying to pass a structure to a function as an output parameter fails -

here's given vendor describe function. typedef struct { float distance_sm; float distance_nm; short fuel_stops; char flight_time[8]; char block_time[8]; char departure_time[8]; char departure_date[12]; char arrival_time[8]; char arrival_date[12]; char timezone_change[8]; char messages[fosapi_msg_len]; } fos_leg; fos_extern_c bool dll_exp_util fos_calc_flight( char *leg_date, // in: leg date ( char *leg_time, // in: leg time ( char *airport_from, // in: airport icao(4) or iata(3) (kokc) char *airport_to, // in: airport icao(4) or iata(3) char *aircraft_type, // in: character aircraft type (max len = 4) fos_leg *fos_leg, // in: allocated space fos_leg char errors[fosapi_msg_len], // in: 256 bytes out: error messages bool arrival_date_time=false, // in:

io - How many physical I/O operations required to write one block in RAID 5? -

i understand sum of read , write rates equals i/o rate per second in raid 5 design, how may go calculating how many physical i/o operations take write 1 block exactly? thanks! according this article , takes 4 psychical i/o operations whenever i/o operation done application. these operations follows: read block needs modified read parity block update data block update parity block

scala - Lift RestHelper don't receive my request -

i tried create simple resthelper "hello world" example i'm having trouble. when start container container:start command, serve { case nil _ => extraction.decompose("hello restful world!") } is not invoked in resthelper extension. following message: "the requested url / not found on server" so, seems reason lift ignores liftrules.statelessdispatch.append(service) line in bootstrap.boot.boot definition. , have absolutely no clue why happens. here's boot class: package bootstrap import net.liftweb.http.liftrules import com.yac.restfultest.service class boot { def boot { liftrules.statelessdispatch.append(service) } } and here's service : package com.yac.restfultest import net.liftweb.http.rest.resthelper import net.liftweb.json.extraction object service extends resthelper { serve { case nil _ => extraction.decompose("hello restful world!") } } and in case helps here's w

android - MPAndroidChart - How to align seekbar with x-axis skipping extra padding? -

Image
i'm working mpandroidchart , i'm enjoying since it's done. but i've got problem haven't been able resolve in few hours. i've got seekbar under 3 charts (as can see screenshots below) , i'd align x-axis, skipping space occupied y-axis' labels on left , padding gets added on right. have got suggestion on how achieve goal? there way of knowing labels' width , charts' extra-padding? or, better, can x-axis width? thanks in advance! bye! update latest version of library if have not already. then, remove offsets chart. it's in documentation . call: chart.setviewportoffsets(0f, 0f, 0f, 0f); this remove padding / margin / offset chart, making actual content of chart (the data) being next thing screen edge.

algorithm - How can I parse this plaintext RP-style string into a more generic XML-style one? -

i'm making app translate roleplaying-style messages more generic. user has ability specify preferences, like: moves - /me <move> - *<move>* speech - <speech> - "<speech>" out-of-character - [<ooc>] - ((ooc)) - //ooc i need parse message this: /me eats food "this *munch* good!" [you're @ this] or this: *eats food* *munch* good! ((you're @ this)) into more generic, xml-like string this: <move>eats food <speech>this <move>munch</move> good!</speech> <ooc>you're @ this</ooc></move> but regard inside which. example: *eats food "this munch* good" // you're @ should parsed as: <move>eats food "this munch</move><speech> good" </speech><ooc> you're @ this</ooc> even if that's not user intended. note quotes in last example weren't parsed because didn't wrap complete segment,

What to do if Android emulator has flickering rendering issues? -

when i'm trying start emulator on computer (ubuntu / amd64), android emulator looks this: http://i.imgur.com/yy7tz8f.jpg for me heavily looks gles / opengl emulation issue, have no idea start debugging. other opengl-using applications, such games in steam, work without issues. how fix this? this evicted enabling virtualization in pc (virtualization should enabled in bios settings). processor should support virtualization. assuming have virtualization facilities, follow following steps can boost performance of android emulator. https://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture#_toc358213272

Mocking framework vs functional testing, why bother mocking? -

i understand mocking frameworks can override behavior of objects. makes test easier , faster. simulating objects behaviors in production environment can good. question arises mocking not developer ? @ end functional test (which real world test) show passed or failed. why prolong envitable ? why bother mocking object find out not working in production. why wait functional tester find out codes not working. if did not mock instead used real test find bugs right away instead of pleasing ourselves mocking. argument presented me , might philosphical thoughts on mocking framework vs real world unit testing good question. after decade writing automated developer tests (and creating mocking library needs), can come conclusion unit tests use mocking not best way go. instead, writing acceptance-level integration tests has worked better me. use mocking when there no easy way around it. i suspect there still going take several years before developers share view, though. tod

html - All webpage is marked when touching the screen on mobile devices -

the website problem: dentrist.com the following video explains all: https://drive.google.com/file/d/0b3i1u2c6pdwmb3lmq0lkbkzorgc/view?usp=sharing same result appears on android , apple devices. i've tried fix , find div causing problem, @ least that's believed. thinking css problem. think caused new polymer (web components) i'm using on site. using debug found when pointing on tag/element "body" or "html" marks screen. 1 thing notice selection of link or text working perfectly, following entire page marking reason. don't know how explain in other way. please ! thank you. it problem wordpress plugin. after update plugins, problem solved. although diagnosing hard.

django - ValidationError message doesn't appear in my own form -

i created custom registration form: class myregistrationform(usercreationform): mobile = models.charfield(max_length=16) address = models.charfield(max_length=100) class meta(): model = customuser fields = ['username', 'password1', 'password2', 'first_name', 'last_name', 'email', 'mobile', 'address'] def clean_mobile(self): mobile = self.cleaned_data['mobile'] if customuser.objects.filter(mobile=mobile).exists(): raise validationerror('mobile exists') return mobile def save(self, commit=true): user = super(myregistrationform, self).save(commit=false) user.mobile = self.cleaned_data['mobile'] user.address = self.cleaned_data['address'] if commit: user.save() return user and in template, don't write `{{form}}', instead use bootstrap template registratio

php - How to verify hashed password when a user logs in -

can please tell me how suppose verify hashed password when logging in? here registration code: $db_password = password_hash($password, password_default); // enter info database. $info2 = htmlspecialchars($info); $sql = mysql_query("insert users (first_name, last_name, email_address, username, password, signup_date) values('$first_name', '$last_name', '$email_address', '$username', '$db_password', now())") or die (mysql_error()); this check user code run @ login . . $hash = password_hash($password, password_default); // check if user info validates db $sql = mysql_query("select * users username='$username' , password='$hash' , activated='1'"); $login_check = mysql_num_rows($sql); i can not f

javascript - Wordpress : hide Submenus, but show active submenu (3 tier) -

i've searched , down internet , cannot find answer fits specific needs this. i'd appreciate help. i've set menu in wordpress, , have set jquery code hide .sub-menu top level menu items show. on click, second tier opens, , clicking on 1 of open third tier. third tier url links, others #. that works lovely. problem is, when user clicks on third-tier link, , taken relevant page, want tier stay open on new page. i've managed assign .active class li within ul open page, can't seem target in jquery force show sub-menu ul/li has .active class... any ideas? my jquery: $('.sub-menu').hide(); //hide children default $('li a').click(function(){ $(this).siblings('.sub-menu').slidetoggle('slow'); } how target correct navigation tier keep 1 open when viewing page?

java - Cannot log in to the MySQL server after loging in in localhost using Tomcat -

so here deal. can connect mysql credential when run tomcat 7 , web app in localhost:8080 @ first see app can "read" db. when try log in though, after that, can't access phpmyadmin mysql credentials , don't know why. think auto-creating threads/connections??? os:win7 i can guess not closing/releasing connections on java. check how many concurrent connections have open on mysql: show processlist; also maximum mysql allows: show variables 'max_connections' if have many concurrent connections, should search not closing or releasing connections in code.

php - How can i change the timestamp to my own timezone in mysql? -

how can change timestamp own timezone in mysql? here php code below: $sql = "create table `mytable` ( `id` int(6) unsigned not null auto_increment, `firstname` varchar(30) not null, `lastname` varchar(30) not null, `email` varchar(50), `reg_date` timestamp not null default current_timestamp on update current_timestamp, primary key (`id`) ) "; for single table , column, make view, converting timestamp column server's timezone actual timezone when select view instead of table itself. create view `v_mytable` select id ,firstname ,lastname ,email ,convert_tz(regdate,'uct','us/pacific') regdate mytable; if don't have convert_tz installed it's outlined on here how install it: mysql convert_tz()

pandas - Set column name for apply result over groupby -

this trivial problem, triggering ocd , haven't been able find suitable solution past half hour. for background, i'm looking calculate value (let's call f) each group in dataframe derived different aggregated measures of columns in existing dataframe. here's toy example of i'm trying do: import pandas pd import numpy np df = pd.dataframe({'a': ['x', 'y', 'x', 'y', 'y', 'y', 'y', 'x', 'y', 'x'], 'b': ['n', 'n', 'n', 'm', 'n', 'm', 'm', 'n', 'm', 'n'], 'c': [69, 83, 28, 25, 11, 31, 14, 37, 14, 0], 'd': [ 0.3, 0.1, 0.1, 0.8, 0.8, 0. , 0.8, 0.8, 0.1, 0.8], 'e': [11, 11, 12, 11, 11, 12, 12, 11, 12, 12] }) df_grp = df.groupby(['a','b']) df_grp.apply(lambda x:

php - Cannot redeclare class AbstractFindAdapter -

i have error in laravel install has cropped [seemingly] intermittently. follows below: [2015-04-22 15:30:45] production.error: exception 'symfony\component\debug\exception\fatalerrorexception' message 'cannot redeclare class symfony\component\finder\adapter\abstractfindadapter' in /var/www/web/website/htdocs/vendor/symfony/finder/symfony/component/finder/adapter/abstractfindadapter.php:28 stack trace: #0 [internal function]: illuminate\exception\handler->handleshutdown() #1 {main} [] [] [2015-04-22 15:32:39] production.error: exception 'symfony\component\debug\exception\fatalerrorexception' message 'cannot redeclare class symfony\component\finder\adapter\abstractfindadapter' in /var/www/web/website/htdocs/vendor/symfony/finder/symfony/component/finder/adapter/abstractfindadapter.php:28 stack trace: #0 [internal function]: illuminate\exception\handler->handleshutdown() #1 {main} [] [] it seems coming vendor files, , based on how short stack

node.js - Custom LoadBalaner probing for https endpoints in Azure CloudServices -

about case: have node.js rest api deployed in azure cloudservice. node.js process hosted in iis using iisnode. because of default probing doesn't work might entire iis process down or when wrong in node.exe process , default probing not encounter issue. solution trying implement custom probing. the problem: trying make azure loadbalancer use custom probe endpoint 1 of cloudservices discussed in this article. struggling fact seems custom loadbalancing probes available public input endpoints using http, tcp or udp. in case have limitation should expose endpoints under https protocol. here cloudservice definition: <servicedefinition xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" name="dec-api-server" xmlns="http://schemas.microsoft.com/servicehosting/2008/10/servicedefinition"> <webrole name="dec-api" vmsize="small"> <certificates>

function - python - sieve of Eratosthenes when number is prime print "1" when not print "0" -

i must create function f(n) value 1 when number prime or value 0 when isn't prime. code working prints in revers order. example: f(6)= 0 0 1 1 0 1 0 def prime(n): if n<2: return false in range(2,n): if n%i == 0: return false return true def f(n): print('0', end=' ') a=1 while a<=n: n=n-1 print('1' if prime(n) else '0', end=' ') f(6) reverse loop like: def f(n): print('0') in range(1, n+1): print('1' if prime(a) else '0') ps have seen examples of how actually implement sieve of eratosthenes in python on stack overflow, worth searching better solution.

c# - Windows "Runtime" app (PC vs Phone) - Is it the same notification API? -

i'm beyond confused trying grasp what regarding microsoft's called "runtime" apps (also called "universal" or convergence of windows 8.1). i'm building app both windows 8.1 , phone 8.1 , wondering, notification api same? since i'm having trouble understanding what, it's hard google i'm after. if googled "phone 8 apps" it's wrong, because different. optimally wanna use exact same code phone app windows 8.1 app, possible? sorry if made no sense , thanks! if create universal app, you'll able share exact same notification code between desktop , phone, both share same runtime (called winrt). code find implement notifications on windows 8.1 directly applicable on windows phone 8.1

Strassen's multiplication algorithm for n bits numbers (2way split vs 3way split) -

there version of strassen's algorithm integer multiplication uses three-way split (division of n-bit number 3 parts of n/3 bits) , takes o(n^1.46). my question why method not preferred usual 1 2 way split uses o(n^1.59)? ideas or links can me understand? (i looked online couldn't find anything) that because in practise second 1 slower. o notation doesn't correspond real running speed. example: f(n) = 1000*n g(n) = n*lg(n) o(f(n)) better o(g(n)), making f(n) "faster", while in practise n never large enough prefer f(n).

css - Height of div container fitting screen -

Image
i created following layout: what want achieve is, red , blue container have 100% height inside wrapper. html code far: @extends('master.main') <!-- section insert pagetitle --> @section('pagetitle') title @endsection <!-- section insert content --> @section('content') <div class="menu-bar"></div> <div class="main-content"> <div class="row row-no-padding"> <div class="col-md-7"> <div class="content-container-left">test</div> </div> <div class="col-md-5"> <div class="content-container-right">test</div> </div> </div> </div> @endsection and styling: #main-content-wrapper { height: 100%; margin-left: 60px; background-color: #f7f8f9; } .main-content { margin-left: 15px;

java - How to increase the buffer size in Handler? -

i'm working on plotting graph on android app. want use buffer size equal 512 store incoming data arduino. after buffer full graph plotted , keep going. how can change code achieve this? handler mhandler = new handler(){ @override public void handlemessage(message msg) { // todo auto-generated method stub super.handlemessage(msg); switch(msg.what){ case bluetooth.success_connect: bluetooth.connectedthread = new bluetooth.connectedthread((bluetoothsocket)msg.obj); toast.maketext(getapplicationcontext(), "connected!", 0).show(); string s = "successfully connected"; bluetooth.connectedthread.start(); break; case bluetooth.message_read: byte[] readbuf = (byte[]) msg.obj; string strincom = new string(readbuf, 0, 5); // create string bytes array log.d("strincom", strincom); if (stri