Posts

Showing posts from August, 2012

Regex, PHP: assigning matches to an array after inserting expanded words -

regex, php: assigning matches array after inserting expanded words in system matches user input against regex pattern allow pattern contain "concept words" marked twiddle (~). e.g. can define ~service-type '"oil change" rotation brake "tune up"' , ~day 'monday tuesday wednesday thursday friday' i can have pre-regex like: .*get.*~service-type.*~day which preprocessing gets expanded to: /.*get.*(oil change|rotation|brake|tune up).*(monday|tuesday|wednesday|thursday|friday)/i so match sentence like: "i'd oil change on wednesday." this gives me nice $matches array looks this: array 0 => string 'i'd oil change on wednesday' (length=42) 1 => string 'oil change' (length=10) 2 => string 'wednesday' (length=9) the difficulty arises possible or necessary regex contains other (...) patterns. in example wouldn't need it, shows point: (.*)(get).*~service-type(.*)~day...

html - Applying jQuery code to AJAX loaded content -

i have these html lines <h1 class="trigger">headline one</h1> <div class="toggle_container"> body text 1 </div> and jquery code in <head> section of site $(document).ready( function() { $('.trigger').not('.trigger_active').next('.toggle_container').hide(); $('.trigger').click( function() { var trig = $(this); if ( trig.hasclass('trigger_active') ) { trig.next('.toggle_container').slidetoggle('slow'); trig.removeclass('trigger_active'); } else { $('.trigger_active').next('.toggle_container').slidetoggle('slow'); $('.trigger_active').removeclass('trigger_active'); trig.next('.toggle_container').slidetoggle('slow'); trig.addclass('trigger_active'); }; return false; }); }); ...

yarn - Hadoop: how to set HADOOP_YARN_HOME correctly -

i'm trying setup hadoop yarn. the default yarn.application.classpath property set this. yarn.application.classpath <value> $hadoop_conf_dir, $hadoop_common_home/*,$hadoop_common_home/lib/*, $hadoop_hdfs_home/*,$hadoop_hdfs_home/lib/*, $hadoop_mapred_home/*,$hadoop_mapred_home/lib/*, $hadoop_yarn_home/*,$hadoop_yarn_home/lib/*, </value> with configuration mr jobs failing. if substitute (hadoop_yarn_home substituted value) works fine. <name>yarn.application.classpath</name> <value> $hadoop_conf_dir, $hadoop_common_home/*,$hadoop_common_home/lib/*, $hadoop_hdfs_home/*,$hadoop_hdfs_home/lib/*, $hadoop_mapred_home/*,$hadoop_mapred_home/lib/*, /usr/lib/hadoop-yarn/*,/usr/lib/hadoop-yarn/lib/*, </value> so, suspect resourcemanager has incorrect value of $hadoop_yarn_home set somewhere. i've tried setting in yarn-env.sh, hadoop-env.sh , /etc/default/hadoop-yarn, jobs keep failing. my question is, have set...

scala - Recommended style for arity-1 call followed by arity-0 call -

given official scala style guide http://docs.scala-lang.org/style/method-invocation.html recommends using infix notation arity-1 calls , dot notation arity-0 calls, what's recommended style arity-1 call followed arity-0 call? for example, recommended way? (bytes map (_.tochar)).mkstring the summary of style guide basically: use point-free style whenever simple , clear. otherwise, don't. in case, options are bytes.map(_.tochar).mkstring (bytes map (_.tochar)).mkstring and former looks simpler , clearer me, wins. really long chains not clear in point-free notation foo bar baz qux quux bippy say again? foo.bar(baz).qux(quux).bippy oh, okay. be pragmatic. point-free style can clean , elegant. coding style lead write code looks nice point-free. point of syntax clear , avoid errors, use whichever better accomplishes goal.

javascript - Backbone.js site across different ports -

i've got backbone site i'm trying , running. api want feed lives on same server, on different port (port 8080). when try , access api, errors 'same origin policy' , such, since they're on same server, i'm not sure i'm doing wrong. how can access data api model? define(function (require) { "use strict"; var $ = require('jquery'), backbone = require('backbone'), api = "http://localhost:8080/api/v1/", candidate = backbone.model.extend({ urlroot: api + "profiles/", idattribute: 'password', initialize: function () { console.log('candidate initialized'); }, validate: function (attributes) { console.log('validate'); console.log(attributes); }, }), candidatecollection = backbone.collection.extend...

maven - Are there best practices in using bower in a source-controlled, mavenized, java web application -

i'm quite new bower not web application development. previously, i've downloaded required javascript , css files third-party libraries/frameworks , placed them web application's src/main/webapp/scripts (or equivalent) folder. ensures files needed web application deployed. with default setup, entire bower_components directory committed source control , if follow examples referencing bower package, e.g., <script src="/bower_components/jquery/jquery.js"></script> i'm going end deploying entire bower_components directory web application. seems huge overkill (especially use jquery ui because themes downloaded bower). is there best practices in using bower web application such application isn't bloated unnecessary third-party library files? please remember java , maven web application. seeing tagged maven on question, disagree checking in 3rd party libraries, after having tasted goodness of maven dependency management :) no m...

php - Stop posts from being displayed after certain day -

i have created pagination function travel company. there 2 things want change can't figure out. each trip has date. want able stop trip displaying in list 1 day of trip , subsequent days. have rough idea, doesn't seem work. if (date($row['date']) getdate()) { // echo trip info here } -2. after each of trips in list there seperator (is right word?) separate each trip's info. on last trip if page don't want seperator. have no clue how :/ thanks in advance & advice. <?php if (isset($_get["p"])) { $page = $_get["p"]; } else { $page=1; }; $start_from = ($page-1) * 4; $sql = "select * destinations order date asc limit $start_from, 4"; $result = mysqli_query ($con,$sql); while($row = mysqli_fetch_array($result)) { echo "<div class='row'>"; echo "<div class='col-md-4 col...

java - spark 0.9.1 on hadoop 2.2.0 maven dependency -

i set apache spark maven dependency in pom.xml follows <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-core_2.10</artifactid> <version>0.9.1</version> </dependency> but found dependency use " hadoop-client-1.0.4.jar " , " hadoop-core-1.0.4.jar ", , when run program got error " org.apache.hadoop.ipc.remoteexception: server ipc version 9 cannot communicate client version 4 ", shows need switch hadoop version 1.0.4 2.2.0. updates : is following solution correct method solve problem? <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-core_2.10</artifactid> <version>0.9.1</version> <exclusions> <exclusion> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-core</artifactid>...

macvim - Vim tip: Esc is really far away for my pinky, I have short pinkies, don't hate. Here's what to do -

they can center of keyboard fastest , efficient. think esc pretty damn far pinky stretch. should do? there several options: can alternatively press ctrl + [ , equivalent esc . can define mapping, e.g. jj , or jk , kj . or remap convenient key (caps lock, ctrl), esc. you'll find lenghty discussion @ avoid escape key on vim tips wiki. i recommend mapping conveniently located, seldomly used caps lock esc . described in map caps lock escape in windows , map caps lock escape in xwindows .

How do I handle user defined exceptions in Python? -

if have error module defined containing application defined exceptions like: class error(exception): pass class noschemaversion(error): def __init__(self): self.code = 1 self.msg = "no schema version specified" pass class nomsgtype(error): def __init__(self): self.code = 2 self.msg = "no message type specified" pass how handle specific exceptions when raised. tried like: import error errors = error.error() try: <do stuff> except errors.nomsgtype: <stuff> but message: attributeerror: 'error' object has no attribute 'nomsgtype' what doing wrong? error.error() (stored in error ) constructs new value of error class, nomsgtype separate class isn't part of error , , error.nomsgtype doesn't exist. catch nomsgtype , should write except error.nomsgtype: .

CakePHP containable how to do a recursion with join? -

i want retrieve tree nodes recursively , want join each [node] [level] node: ... public $belongsto = array( 'parent' => array( 'classname' => 'node', 'foreignkey' => 'parent_id' ), 'level' => array( 'classname' => 'level', 'foreignkey' => 'level_id' ) ); ... controller: $this->node->contain(array( 'parent.parent.parent.parent.parent', )); $parenttree = $this->node->findallbyid($id); the recursion works want each node have level element , it's not case. how correct contain parameter? levels recursive in case want restrict recursion - need first one

maven - Creating a scheduled task in Nexus via the REST API -

one of parameters schedules rest api endpoint of nexus provides schedule . defines frequency created task executed. available options in ui are: manual, once, hourly, daily, weekly, monthly , advanced. however, when try create scheduled task via rest api , specify schedule different manual, 500 status code in reply (and means server encountered unexpected condition did not allow fulfil request). guess i'm missing additional parameters, because, via nexus ui, see choosing (for instance) hourly schedule presents few options (e.g. start date , start time). as explained in api's documentation , schedules end point provides way pass parameters in key, value pairs (via properties element). my question 2 fold: is assumption missing parameters correct? if so, correct formats key, value pairs each of possible schedules? disclaimer: following works nexus 2.14. think nexus 3.0 doesn't have rest-api , 3.1, don't know if has 1 or no. so, way of figuring...

cannot start iphone simulator using calabash-ios -

i've been searching solution few hours now, , can't seem find problem reported anywhere else, here goes... first, environment: localhost:calabash-ios-example jenkins$ xcode-select --print-path /applications/xcode.app/contents/developer localhost:calabash-ios-example jenkins$ xcodebuild -version xcode 5.1.1 build version 5b1008 localhost:calabash-ios-example jenkins$ calabash-ios version 0.9.168 irb(main):001:0> calabash::cucumber::framework_version "0.9.168" i know should provide server_version, cannot that... see below.. so, issue cannot start simulator. @ first, getting econnrefused, enough, realized needed set app_bundle_path, that's sorted now. however, when try run tests, simulator tries start, stays few seconds, crashes, , restarts... , following error message: localhost:<path> jenkins$ app_bundle_path="build/<app>-cal.app" cucumber 0:35: execution error: iphone simulator got error: application isn’t running. (-600) f...

sql server - Large Scale Distributed Application in AWS / Azure -

i working on large scale web app users can anywhere in world. considerations: 1. web servers needs distributed in possibly 3 data centers possibly across 3 continents. 2. each datacenter might have 2 webservers (asp.net) start , can scale out 3. database needs partitioned (sql server sherding). not thinking of separate database instances , mirroring 4. application have media contents. so, cdn might right fit them. hosting options: 1. azure/aws iaas: in case web , applciation servers needs configured , managed 2. azure/aws paas: here tied using vendor specific tools, code blocks , "way of doing things" , 1 fine morning announce retiring dependant service (eg. sql azure federation). also, consider limits around db max size 150gb az sql , throttling within shared services. so, hosting option 1 looks safe bet around. now questions: i need consider load balancing server each data center route traffic 2 or more web servers in data center. managing traffic anywhere of...

Date in Grails criteria does not return any records -

i using grails criteria retrieve records oracle db. below, def = domainclass.createcriteria() def recordlist=a.list{ 'lt'("modifieddate", mydate) } but not return records, when run query sql same mydate works when pass under oracle to_date function. mydate java.util.date. tried formatting using simpletextformat , converting groovy date using new date(). but same result

c# - IDE intellisense not working in visual studio 2013 -

i using visual studio 2013,devexpress 12.2 , mvc 4.the application complies , runs gives me following errors: "the name model not exist in current context" "system.web.webpages.html.htmlhelper doe not contain definition dexexpress". searched google , followed workarounds mentioned in link: http://connect.microsoft.com/visualstudio/feedback/details/760443/visual-studio-2012-ide-loses-intellisense-and-reference-resolution# still not work.i checked webconfig file.am still missing anything?

c++ - what is causing this seq fault in Qt QGuiApplicationPrivate::processNativeEvent() -

i have simple qt program reading shared memory in separate thread. call routine waits until there data in shared memory segment, unblocks , returns , emits signal main gui thread. main gui thread slot received , in routine print std::cout received returns--no further data processing. program runs find 30 seconds seq faults. running program under gdb catches seq fault , trace shows fault deep in event processing of qt. none of own code involved in seq fault. totally lost problem is. here gdb output. in following gdb output, readsm() routine 1 blocks until there data available read shared memory, , readdatabuffer() slot main gui thread returns without further processing. there tons of std::cout lines signal , slot before seg fault. ...many of following 2 lines before fault... datareader::readsm(): calling m_psharedmemory->readwait() readdatabuffer(): entered, returning datareader::readsm(): calling m_psharedmemory->readwait() readdatabuffer(): ...

asp.net mvc - Use Model object value in Client template Telerik Grid mvc -

i need display 2 different values in grid based on model object property.i able using template not client template. how it? i have used below code getting error iscontractorpo undefined. @{ model.iscontractorpo = "p"; } <div> @{html.telerik().grid(model.testlist) .name("testgrid") .columns(columns => { columns.bound(col => col.fte); columns .template(@<text>@if (model.iscontractorpo == "c") {<div>@item.fte</div>} else if (model.iscontractorpo == "p") {<div>-</div>}</text>).title("ftetestcolumn") .clienttemplate("<# if (model.iscontractorpo == 'c') { #> <div><#=fte#></div><# } else if(model....

java - Convert from Double to String in Android -

i trying convert value double string in android activity.i can work first example here below (working in sense of no squigly error eclipse). curious why second example not working. first example balance = (textview) findviewbyid(r.id.textviewcardbalance); intent intent = getintent(); if (intent.getextras() != null) { balance.settext(string.valueof((long)intent.getdoubleextra("balance", 0.00))); } second example below not working (error: "cannot cast double long" balance = (textview) findviewbyid(r.id.textviewcardbalance); double cardbalance; intent intent = getintent(); if (intent.getextras() != null) { cardbalance = intent.getdoubleextra("balance", 0.00); balance.settext(string.valueof((long)cardbalance); } would know how can second example work need log value retrieved intent before passing textview. thanks why can't this? balance.settext(cardbalance + "");

python - Avoid Mandrill errors with Sentry -

i have installed sentry instance on server, , want configure send alert emails using mandrill , django integration djrill . here's relevant settings in sentry.conf.py file i'm using: extra_installed_apps = ( 'djrill', ) email_backend = 'djrill.mail.backends.djrill.djrillbackend' mandrill_api_key = '[... mandril api key ...]' default_from_email = 'my-mandrill-allowed@email.address' server_email = 'my-mandrill-allowed@email.address' and setup works, except part reason mandrill doesn't allow setting message-id header: notsupportedbymandrillerror: invalid message header 'message-id' - mandrill allows reply-to , x-* headers (this exception raised djrill, not response mandrill) which set sentry here : class messagebuilder(object): # ... @cached_property def message_id(self): if self.reference not none: return email_id_for_model(self.reference) i have managed make work editing...

ruby on rails - Installing gem "binding_of_caller" creates error and will not install -

i've attempted bundle following gem: gem 'binding_of_caller', '~> 0.7.2' this results in following error message. i've looked around see how fix can't find helps. /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:85:in `mkdir': error: failed build gem native extension. (gem::ext::builderror) permission denied - ./.gem.20140529-2393-154cu0 gem files remain installed in /library/ruby/gems/2.0.0/gems/binding_of_caller-0.7.2 inspection. results logged /library/ruby/gems/2.0.0/extensions/universal-darwin-13/2.0.0/binding_of_caller-0.7.2/gem_make.out /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:85:in `block in mktmpdir' /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:142:in `create' /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:85:in `mktmpdir' /library/ruby/site/2.0.0/...

sockets - How does Firebase javascript .on('value') callbacks work? -

i wondering how 1 go implementing similar firebase with: firebaseref.on('child_removed', function(oldchildsnapshot) { // code handle child removal. }); how write server this? using webhooks behind scene? how calling function when value changes? any great, thanks. you can use websockets achieve functionality. checkout feathersjs . can use socketio listener or adapter such can.feathers(canjs). adapter exist other frameworks such angular, doesn't yet.

Using Excel VBA to Select a filtered range where results will vary -

i working spreadsheet produce report. data vary depending on department reporting. need select records in column result of filter , paste them in column b, once pasted need clear cells in column remove filter. have been able accommodate variable criteria filter; however, problem selecting variable range. data selected never start in cell a2, cell after fair game. how select range varies? how have user interact macro select cells? this works me filter variables. cells.select selection.autofilter activesheet.range("$a$1:$f$65000").autofilter field:=1, criteria1:=array( _ "1000", "1001", "1005", "zbil", "1002", "1003", "1004", "1006", "1007", "1008", "1009", "aoms", "asps", "natl", "zcon", "zrep"), operator:=xlfiltervalues on error resume next i using following select range, first line works select data cop...

android - Changing the Size of my ListView by one Pixel messes up Formatting -

let me show 2 links demonstrate point: http://i.snag.gy/qp1i2.jpg (the listview 60 pixels) http://i.snag.gy/dvxsl.jpg (the listview 61 pixels) the whole file done outer vertical linearlayout provide weighted percentages (e.g. listview 75%, search part 4%, on , forth) independent of device screen size. within outer linearlayout have nested layout (linear or relative) depending on needs particular row. it works beautifully, except last part. , seems lot of items try adding end messing formatting i'm not sure if problem how i'm doing listview. anyways, here's relevant code: <relativelayout android:layout_width="fill_parent" android:layout_height="0dip" android:background="@null" android:layout_weight="0.75" android:paddingleft="0dip" > <imageview android:id="@+id/searchdivider" android:layout_width="wrap_content" android:layout_height=...

css - bootstrap 3.1.1 navbar wont collapse on phone -

i have following code. on phone, navbar wont collapse after expanding, have click button toggle style. idea? <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <a ui-sref="default" class="navbar-brand"></a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="navbar-main"> <ul class="nav navbar-nav"> <li ...

javascript - jQuery: using $(this) inside of $.ajax success function -

i'm making $.ajax call, , following code not work intended. alert results in 'undefined' $(document).ready( function { $(".elem").on("click", function(e) { e.preventdefault(); $.ajax( { url: 'index.php', data: { 'action': 'something' }, success: function() { alert($(this).data("foobar")); } }); }); )}; however, able working adding alias $(this) before entering ajax function. $(document).ready( function { $(".elem").on("click", function(e) { var old_this = $(this); e.preventdefault(); $.ajax( { url: 'index.php', data: { 'action': 'something' }, success: function() { alert(old_this.data("foobar")); } }); }); )}; i can't assign unique ids element being clicked, accessing via $("#id") isn't option. is there m...

filter - List-Comprehension in Erlang - Variable unbound in guard -

i trying build list recursively method. ol (occurence list of characters) list shrink []. need use q in guard check if item can subtracted. shall produce filtered cartesian product. b([[]], _)->[[]]; b(_, [])-> [[]]; b(ol, keys)->[y++[q] || y <- b(subtract(q,ol), keys), q <-keys, len(subtract(q,ol)) < len(ol)]. but error: variable 'q' unbound is there way use value @ place? the subtract-method filters characters out of list. subtract([{$a,1}],[{$a, 5},{$b, 1}]) returns [{$a, 5},{$b, 1}]. len() sums integer values of each tuple. len([{$a, 5},{$b, 1}]) returns 6. try put q generator before usage in y generator. guess definitions applied left right when y applied there no q defined.

javascript - UIWebView incorrect content height -

i'm trying resize uiwebview fits entire contents of loaded page. this, content height of webview's scrollview, , set height of webview value. for content height on 200, works fine, , view scales fit page without space. content of height under 200, webview seems hit sort of height floor, , webview.scrollview.contentsize.height won't return values under 200. i'm left ton of whitespace. there number of posts on topic, none seem cover particular issue. best way return actual content height when value under 200? edit: here's example of html should render quite short, ends being 200pt tall. <meta name='viewport' content='width=device-width, user-scalable=yes'> <html> <head></head> <body style='font-family:helvetica neue; font-size:1.0em; color:#181818; -webkit-font-smoothing: antialiased;'><div> here's example content. <br/></div> </body> please make sure both html...

How to disable http requests and use https exclusively with Jetty 7 -

i haven't found answer yet, maybe else's google foo better mine. i have osgi enabled project using karaf our wrapper jetty. disable http pipe, far have found online how turn on ssl authentication have running. enabled in jetty.xml file adding connector. i have tried removing/commenting out other connector: <!-- <call name="addconnector"> <arg> <new class="org.eclipse.jetty.server.nio.selectchannelconnector"> <set name="host"><property name="jetty.host" /></set> <set name="port"><property name="jetty.port" default="8181"/></set> <set name="maxidletime">300000</set> <set name="acceptors">2</set> <set name="statson">false</set> <set name="confidentialport">8443</set> <set name="lowresourcesc...

oracle - ERROR at line 2: PL/SQL: Statement ignored -

create or replace trigger log_family_increase after update of family_income on student each row begin insert student_2 (name, surname, new_family_income) values (:new.name,surname, :new.family_income, 'new income'); end; in oracle 10g error message: error @ line 2: pl/sql: statement ignored you're missing column name here " (name, surname, new_family_income) ", trying insert 4 values 3 columns.. switched statement, not list out columns, maybe help.. create or replace trigger log_family_increase after update of family_income on student referencing new new old old each row begin insert student_2 values (:new.name, :new.surname, :new.family_income, 'new income'); end;

c# - Why is only the first RadioButton being added to the GroupBox? -

Image
i trying dynamically create windows controls , add them panel. button , checkbox has worked fine; i've run problem groupbox, though, radiobuttons inside it. the first radiobutton element created , added groupbox in expected location, susbequent ones, although ostensibly created (stepping through code makes appear case), not visible. i think if subsequent radiobuttons being plopped atop previous ones, last 1 1 seen. looks like: each ~-delimited val should text value of radiobutton, yet 1 displays. need explicitly provide location vals subsequent radiobuttons, or why failing? here code: private groupbox getgroupbox(string currentsettings, int curleftval) { // "apple~orange~peach~true (must "enclose group in black box" last val (ignore quick-and-dirty mockup, though)) list<string> grpbxvals = new list<string>(currentsettings.split('~')); groupbox gb = new groupbox(); gb.height = 60; gb.location = new point(curleftv...

facebook - 400 Bad Request when implementing custom friend selector -

i'm trying implement custom multiple friend selector invite users game. list of users calling graph api call invitablefriends, , create ui it. after user selects corresponding users, invitation tokens of users, , make call app request follows: public void invitefriends(string message, string title, facebookdelegate callback, string[] = null, string data = "") { if (fb.isloggedin) { fb.apprequest (message, to, "", null, null, data, title, callback); } } but when call made, i'm getting following error: 400 bad request unityengine.debug:logerror(object) fbdebug:error(string) facebook.fallbackdata:jsfallback(string) facebook.asyncrequestdialogpost:callbackwitherrorhandling(fbresult) facebook.<start>c__iterator0:movenext() my callback function never called, can't see error i...

html - Format PHP database data -

what know when grab data database how can format php looks nice. seem getting blank white page , when inspect page google chromes inspect element says i've got 500 internal error. for example, i'm using pdo connect database. heres code: <?php $hostname='localhost'; $username='root'; $password='root'; try { $dbh = new pdo("mysql:host=$hostname;dbname=fitness", $username, $password); $sql = "select * fitness"; $fitnessresult = $dbh->query($s ql); $fitness = $dbh->fetchobject($fitnessresult); foreach ($fitness $fit) { $fitnessarray[] = ['name' => $fit->name, 'id' => $fit->description]; } $dbh = null; } catch (pdoexception $e) { echo "error is: " . $e-> etmessage(); } and here html im using twitter bootstrap framework. <?php include'inc/connect.inc.php'; ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8">...

php - upload files with strange chars when names have accents -

im problem strange chars when inserts on database , solve searching solutions in stackoverflow with: pdo::mysql_attr_init_command => "set names utf8". but, im having problems, when upload files, example, if upload file name "1º class", saved on computer name: "1º class", have problems when use accents on uploaded files. dont understand why happening , none solution this. do know how can solve situations? check content-type of page: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> make sure page coded in uft-8 (eg. notepad++)

javascript - Problems with bubbling event on dragleave -

i have working example dragenter , dragleave events highlight area file should dropped. example works correctly . right if add single <span> inside of dragenter region, highlighting not work correctly anymore (when hover image on top of text - highlighting disappears). see dragleave called multiple times. all changed substituted drop files here <span>drop files here</span> also there knockout code there, believe has nothing bug. understand problem event bubbling, e.stoppropagation(); e.preventdefault(); return false; does not help. idea how make work dom elements indside? p.s. simplified example , looks not able make (i thinking way solve through js, , appears way described it possible solve css well). sorry confusion. example looks more this . not text inside of dropable element, when drop something, elements appears there. these elements clickable. the problem malk's solution :after element stays on top of these clickable eleme...

c++ - "cannot open output file filename.exe: Permission denied" -

i have learned c++ , trying make program using windows.h header. using dev-c++ compiler , getting 3 errors can't find solution to. these errors: cannot open output file filename.exe: permission denied [error] ld returned 1 exit status recipe target 'filename.exe' failed here code: #include &#60windows.h&$62 #include &#60iostream&#62 #include &#60fstream&#62 #include &#60string&#62 #include &#60vector&#62 using namespace std; hwnd textfield; /* input window goes */ lresult callback wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam) { switch(message) { case wm_create: createwindow("static", "docjoin document combiner", ws_visible | ws_child | ws_border, 20,20,300,25, hwnd,null,null,null); break; /* upon destruction, tell main thread stop */ case wm_destroy: { postquitmessage(0); br...

multithreading - mouse movements for background thread created windows forms -

i wondering if possible 1) hosting background thread created windows form inside application main thread created windows form ? or 2) separate thread processes mouse movements thread painting windows form application ? i know these questions sounds crazy, find myself encountering peculiar problem , welcome advice of being able side-step problem, though not think can part windows forms , use different ui technology easily. our software team writes plugins 3-rd party windows form application. provide root main form hosts bunch of user controls them, using api , host them in own windows form. user interfaces created on application's main thread, play nicely each other. many of our user controls provide have system.windows.forms.datavisualisation charts, painted live data application sourcing. 1 of problem have when user moves mouse around erratically display stop updating painting of graphs (gdi+) done on main thread ( use background threads , tpl sourcing , computing data, p...

javascript - Set a number return value for an object -

i've asked similar question, , this answer , know it's possible make objects return strings when placed inside other strings. code based on answer allow object have custom string return value: function mystring(value) { this.string = value; } mystring.prototype.tostring = function() { return this.string; } var strobj = new mystring('foo'); //>> strobj //<< mystring {string: "foo", tostring: function} //>> strobj+'' //<< "foo" //what want in addition this: //>> +strobj //<< 42 i got idea original question seeing effects of date objects within strings. so, since there's feature of date objects quite useful, i'd know if there's way me same thing date objects when used in expression (being converted number): +new date(); //1401414068943 i'd mystring object same. i've tried continue mindset of prototype tostring in object, although there js method convert strings, th...

Need a more efficient threshold matching with function for R -

not sure how best ask question, feel free edit question title if there more standard vocabulary use here. i have 2 2-column data tables in r, first list of unique 2-variable values (u), shorter second, raw list of similar values (d). need function will, every 2-variable set of values in u, find 2-variable sets of values in d both variables within given threshold. here's minimal example. actual data larger (see below, problem) , (obviously) not created randomly in example. in actual data, u have 600,000 1,000,000 values (rows) , d have upwards of 10,000,000 rows. # first create table of unique variable pairs (no 2-column duplicates) u <- data.frame(pc1=c(-1.10,-1.01,-1.13,-1.18,-1.12,-0.82), pc2=c(-1.63,-1.63,-1.81,-1.86,-1.86,-1.77)) # now, create set of raw 2-variable pairs, may include duplicates d <- data.frame(pc1=sample(u$pc1,100,replace=t)*sample(90:100,100,replace=t)/100, pc2=sample(u$pc2,100,replace=t)*sample(90:100,100,repla...

hadoop - hive installation on single node cluster -

i have installed hadoop(1.0.3)single node cluster , have tried install hive(0.13.0)over it. problem everytime start hive,it creates new tables. no history log preserved.i getting error well: warn conf.hiveconf: deprecated: hive.metastore.ds.retry.* no longer has effect. use hive.hmshandler.retry.* instead i able create table , no other sql command working.is there problem hive-site.xml? because there way many config variables in file , don't know do? the error fixed edit hive-site.xml replace hive.metastore.ds.retry width /hive.hmshandler.retry vim /usr/local/cellar/hive/0.13.1/libexec/conf/hive-site.xml :%s/hive.metastore.ds.retry/hive.hmshandler.retry/g :wq

php - Struggling to get month name by using mysql join query -

i want month name below query : select a.`user_name`, month(b.`registered_month`) `users` a, `registered_details` b a.`user_id`=b.`user_id` but returns null value in month(b.registered_month) field. the month function work on date fields. returns numeric month of given date (i.e. 1 2014-01-01). there function called monthname gives name of month of given date. one other note query. typically, join should use on instead of join tables. `users` join `registered_details` b on a.`user_id`=b.`user_id` edit since registered_month numeric value (1,2,3 etc), you'll need use case statement select case b.registered_month when 1 'january' when 2 'february' end case themonth

visual studio lightswitch - Lighswitch wcf ria service with EF 6 -

good day! i create wcf ria service described in this example, example work ef 6.1 , getallorders method return collection database. public class riaservice : domainservice { [query(isdefault = true)] public iqueryable<rb17> getallorders() { var model = new model1(); return model.orders; } protected override int count<t>(iqueryable<t> query) { return query.count(); } } after, create lightswitch project, add datasource wcf ria service , add screen. when run project, list screen return error: "unable load data. please check network connection , try loading again." . please explain me, must initialize connection? on wcf ria service in method gelallorders , works fine, method return collection queryable when set break point. in class model1 added connectionstring. why ls request connection? just checking couple of things: does model1 class return iqueryable < rb17 >? a...

ios7 - How to remove paste from UIMenuController? -

Image
i have added own menuitem uimenucontroller.but problem is showing default items copy, paste etc. want remove these items , want display own menu item. have tried code - (bool)canperformaction:(sel)action withsender:(id)sender { bool can = [super canperformaction:action withsender:sender]; if (action == @selector(showmyalert:) ) { can = yes; } if (action == @selector(paste:)) { can = no; } return can; } you may subclass uitextview or uitextfield , , add these code below. - (bool)canperformaction:(sel)action withsender:(id)sender { // show own menu item return (action == @selector(showmyalert:)); }

php - check the manual that corresponds to your MySQL server version -

can't figure out what's problem code keep getting error on notice: undefined index: userid in c:\wamp\www\myproject\editprofile\edit_save.php on line 10 and could not run query: have error in sql syntax; check manual corresponds mysql server version right syntax use near '(userid, matrix_num,student ,username ,town ,email , txtfavorite,nodate,txtmobil' @ line 1 if($_get) { $noedit = $_post['']; //"select *from " $sql = "select * tblmyprofile student='$name', username='$username', matrix_num='$matric', town='$town' , mail='$email'"; $query = mysql_query($sql, $masuk,$boleh) or die ("gagal query".mysql_error()); $data = mysql_fetch_array($query); } the comma operator invalid in clause. it looks wanted logical and or or operators. query of form this: select t.* tblmyprofile t t.student = 'fee' , ...

java - Eclipse: Creating a search box with the attributes Enter city, zipcode -

hello have little no experience using eclipse wondering how create search field user can enter value. want search field enter city or zipcode until user inputs something. on html it's simple, wondering if knew on eclipse. googled somethings didn't see kept linking me swt widget doesn't seem right. thank in advance this xml file. <!-- editext search --> <edittext android:id="@+id/inputsearch" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/search" android:inputtype="textvisiblepassword"/> <!-- list view --> <listview android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </linearlayout> this above code creates search box user can search city or zipcode. in java file th...

There appears to be an error in Calendar.php -

i trying set start , end times while using event defined calendar.php . $event = new google_service_calendar_event(); $event->setstart($item->start->datetime); my code halted @ line. so, took @ calendar.php google-api-php , found code said: 2999: public function setstart(google_service_calendar_eventdatetime $start) 3000: { 3001: $this->start = $start; 3002: } from here discovered $start member of google_service_calendar_eventdatetime class, simple datetime string not going work. went how $this->start defined. not class google_service_calendar_event . things defined were: 2690: protected $sourcedatatype = ''; 2691: protected $starttype = 'google_service_calendar_eventdatetime'; 2692: protected $startdatatype = ''; so, suspect this->start found in function setstart should this->starttype . however, such noob when comes google api thought should ask experts. thoughts how set start , end times calendar event , write ...

kendo ui - Drag and drop on kendoDiagram -

hi i'm trying develop work flow editor drag, drop , draw, user can drag , drop shapes , connect them create diagram, i'm using kendo ui draggable , drop target drop target has kendodiagram widget. i'm facing issue in making kendodiagram droptarget because initialized kendodiagram please me resolving this. thanks function setdroptargetondiagram(element) { $telerik.$(element).kendodroptarget({ drop: function (e) { var draggable = e.draggable, element = e.droptarget, diagram = element.getkendodiagram(); if (draggable && draggable.hint) { var item = draggable.hint.data("data"), offset = draggable.hintoffset, point = new kendo.dataviz.diagram.point(offset.left, offset.top), transformed = diagram.documenttomodel(point); item.x = transformed.x; item.y = transformed.y; ...

jquery - Advanced checkbox inputs - let user choose a single div -

edit: thank replies! forgot mention better if more <input type="radio"> , 1 theme chosen. here have (not though). function when only 1 input checked not work . also, there's missing function should **uncheck radio button when it's checked. the link: jsfiddle . hope works now. ** i'm creating 3-step form, should have theme chooser. themes display divs. single div looks such this: <div class="theme">theme</div> how the value of clicked div? url params? <div class="theme"><a href="?theme=2">theme</a></div> or possible via form input? <div class="theme"><input type="checkbox">???</div> $('.theme').on('click', function () { var value = $(this).html(); // here go alert(value); });

haskell - Interpreting an abstract syntax graph efficiently -

take minimal language (apparently called hutton's razor): {-# options_ghc -fno-warn-missing-methods #-} data expr = lit int | add expr expr deriving (eq, show) instance num expr frominteger = lit . frominteger (+) = add tree 0 = 1 tree n = let shared = tree (n - 1) in shared + shared if run tree 30 in ghci, type default integer , we'll immediate answer recursive computations of tree shared. if run tree 30 :: expr , enormous syntax tree sharing provided haskell's let doesn't transfer expressions in embedded language. the data-reify library can used observe implicit sharing might present in expression. can add machinery enable that: {-# language derivefunctor #-} {-# language typefamilies #-} import control.applicative import data.reify data exprf e = litf int | addf e e deriving (eq, show, functor) instance muref expr type deref expr = exprf mapderef f (add e0 e1) = add <$> f e0 <*> f e1 mapdere...

java - How to run multiple tests in one instance of driver -

i have following code, extracting data excel sheet , filling web form. registration form , registering 2 users. once second test runs, starts instance of driver. may know how in 1 instance. @runwith(parameterized.class) public class form { private static webdriver driver; private string first; private string last; private string phone; private string country; private string about; public form(string first, string last, string phone, string country, string about) { this.first = first; this.last = last; this.phone = phone; this.country = country; this.about = about; } @before public void before() { driver = new firefoxdriver(); driver.manage().window().maximize(); } @parameters public static collection<object[]> supplydata() throws ioexception { file excel = new file("c:\\users\\master\\desktop\\search_query_log.xls"); fileinputstream fis = new fileinputstream(excel); hssfworkbook wb = new hssfworkbook(fis); hssfsheet ws = wb.getsheet(...