Posts

Showing posts from July, 2011

How do I regenerate imagecache thumbnails in drupal 6? -

Image
my thumbnails images missing hosting account causing gallery images show broken shown in screenshot. i have tried creating new gallery , uploading images gallery hoping rebuild thumbnails has failed well. somehow image cache not creating thumbnails anymore , removed there completely. images in specific image style generated when ever image in style (thumbnail if like) displayed on page, file doesn't exist. if fails check first: first check file permissions. can php write /sites/default/files do have original image. maybe thumb can't generated because original image missing or it's not allowed php read (file permissions again). maybe php graphic library not installed (correctly) generation process fails.

Arduino Uno - EEPROM locations not consistant -

i trying write items eeprom , later read them out. finding reading not getting same put in @ times. narrow down example can show you. below read variables 2 address. const int start_add_type = (eeprom.length() - 10); const int start_add_id = (eeprom.length() - 4); i @ value (via rs232) serial.begin(9600); serial.println(start_add_type); serial.println(start_add_id); of them @ start of setup() , see get 1014 1020 i again @ end serial.println(start_add_type); serial.println(start_add_id); and get 1014 818 i cannot see why should change. did try calling them const e.g. const const int start_add_type = (eeprom.length() - 10); const int start_add_id = (eeprom.length() - 4); but gave same result. here sit puzzled @ must have missed. got idea? #include "eeprom.h" int start_add_type = (eeprom.length() - 10); int start_add_id = (eeprom.length() - 4); char id[7] = "encpg2"; char stored_id[5]; char input[10]; //string type; void setup() { s

java - How specify realization of interface in xStream? -

the xml description of entities "messages". <message id="11600005" name="some_name"> <sourcepartitionid>11600</sourcepartitionid> <destpartitionid>11700</destpartitionid> <payloadid>1300005</payloadid> <sourceudp>1045</sourceudp> <destudp>1046</destudp> <sourceip>10.4.48.0</sourceip> <destip>10.4.49.0</destip> <sourceport id="1045" name="sp_q_1045_11600_11700_005"> <type>queuing</type> <maxmessagesize>8192</maxmessagesize> <characteristic>1</characteristic> </sourceport> <destport id="1046" name="dp_q_1045_1046_11600_11700_005"> <type>queuing</type> <maxmessagesize>8192</maxmessagesize> <cha

Reverse css-animation on class removal without animation onload -

i want transition 1 additional step -webkit-clip-path. way know css animation. click on menu-trigger adds class .menushown body . menu reacts animation. on removal of .menushown animation should reversed. way know animation on main element. way animation triggered on load. here pen illustrating problem. additionaly can't animation-fill-mode work in example. i use animation / transitions after adding / removing classes , have been wondering how done actual css animations without problem of initial animation. http://codepen.io/katerlouis/pen/kxzadl .menu { -webkit-clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%); animation: menuclippath 2000ms linear; animation-direction: reverse; } body.menushown .menu { animation: menuclippath 2000ms linear; // animation-fill-mode: forwards; } @keyframes menuclippath { 0% { -webkit-clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%); } 50% { -webkit-clip-path: polygon(0 0, 100% 0, 100% 50%, 0 85

ios - Error after adding GoogleMap API in the project -

Image
its been 2 days figuring out solve problem unable so. have been getting error after adding google api project.can tell me problem. can't figure out. why saying googlemaps framework not found have in project.

Java runtime issue from Swing application -

i have 1 swing application executing 1 jar file, processing internally. process have below: 1. 1 java file main() loads swing gui. gui can browse , load required jar files execute. public static void main(string[] args) { javax.swing.swingutilities.invokelater(new runnable() { public void run() { migrationprocesselementdialog.createandshowgui(); } }); } from swing application loading jar file as: runtime rt = runtime.getruntime(); // replacepath path of jar file loaded. process proc = rt.exec("java -jar " + replacepath); int exitval = proc.waitfor(); when trigger execution, task manager seeing, 2 javaw.exe (one eclipse, 1 swing gui) , 1 java.exe program flow. program flow continues few times (evident log update) stuck after time. as as, kill swing gui javaw.exe; program flow starts , continues rest of part promptly. seems me somehow javaw.exe blocking java.exe execution. @ possible? what's resolution of it?

sql - How can I restrict a query that uses STUFF to only return one record for each group of values stuffed rather than one for each stuffed item? -

with query: select s.unit, lu.reportname, s.nextexecution, stuff((select ','+emailaddr reportsunitemails e s.unit = e.unit , s.reportid = e.reportid xml path('')),1,1,'') allemailaddresses, s.nextexecutionsbegindatearg, s.nextexecutionsenddatearg reportsscheduler s full join reportslu lu on s.reportid = lu.reportid full join reportsunitemails e on s.unit = e.unit , s.reportid = e.reportid order s.unit, s.reportid ...i want same count of records exists in rreportsscheduler table, in fact getting 1 record each related email address (emailaddr reportsunitemails). where there 1 email address, 1 record returned; there 4 email addresses, 4 records returned; etc. so question is: can "distinctify" complex query return 1 record each email address (while still stuffing them "allemailaddresses"). i tried this: select s.unit, lu.reportname, s.nextexecution, distinct(stuff((select ','+emailaddr reportsun

Android MediaPlayer to play video stream in Service screen rotation -

i create activity video player play online stream using mediaplayer class , surfaceview display. i'm creating mediaplayer in separate service after screen rotation player don't have created again , don't have connect stream. problem don't know how write activity service wouldn't start every time after screen rotation. my code below, in onstart() start service don't know how change didn't start every time. public class videoplayeractivity extends activity implements surfaceholder.callback { private string path; private surfaceholder vidholder; private surfaceview vidsurface; private videoservice videoservice; private intent playintent; private boolean videobound = false; private serviceconnection musicconnection = new serviceconnection() { @override public void onserviceconnected(componentname name, ibinder service) { videoservice.videobinder binder = (videoservice.videobinder) service;

c# - Quartz.Net - How to associate an object to an IJobDetail -

i'm using quartz.net in project , want associate object ijobdetail. i know there option of using usingjobdata but can put there strings, ints , such, want put there object, how do that? so i've found answer after trying few things self, kinda wired not in documentation, whatever. this how goes: idictionary<string, object> data = new dictionary<string, object>(); data.add("data#1", mydata1); data.add("data#2", mydata2); ijobdetail job = jobbuilder.create<myjob>().setjobdata(new jobdatamap(data)); and in execute method in job receive this: var data1 = context.jobdetail.jobdatamap.get("data#1");

ios - How to replace value in array of dictionary in swift? -

i have array of dictionary, trying store in nsuserdefault contain <null> app crash, can replace <null> ""? there way resolve issue? this array of dictionaries: var array = ( { clinicid = "<null>"; "patient_surveyid" = 1956; "patient_treatment_planid" = "<null>"; physicianid = "<null>"; }, { clinicid = "<null>"; "patient_surveyid" = 1956; "patient_treatment_planid" = "<null>"; physicianid = "<null>"; }, ) so have array of dictionaries let list: [[string:any]] = [] and each dictionary of type [string:any] . this code replace nsnull values dictionaries "&

How to drop hive partitions with setting limit -

i have drop alter query , want set limit it. query : alter table dim_known_hosts drop if exists partition (dimensional_partition_folder<'2016_01_04_00_30'); it drops partition less 2016_01_04_00_30 . want delete first 10 .

uiviewcontroller - Present a view modally from the appDelegate swift -

i have nstimer in appdelegate,when interval of time chosen has passed application needs present viewcontroller modally selector's timer in appdelegate.is possible ? appdelegate not manage view. should present viewcontroller modally in first view controller gets put on screen.

c++ - GCC compiler warning flag for zero variadic macro arguments -

what compiler warning flag 0 variadic macro arguments in gcc (i using gcc 5.3.0)? the warning triggered code this // illustration purposes only: int foo(int i) { return 0; }; #define foo(a, ...) foo(a, ##__va_args__) foo(1); ^ warning: iso c++11 requires @ least 1 argument "..." in variadic macro but warning doesn't indicate flag used enable/disable warning (this typically shown in square brackets [-wwarning-flag-name] ). in clang -wgnu-zero-variadic-macro-arguments . haven't been able find in warning documentation of gcc-5.3.0 . i've tried -wgnu-zero-variadic-macro-arguments , -wvarargs , -wno-variadic-macros (thanks @ revolver_ocelot) none of these in charge of warning. the warning flag causing issue -wpedantic . because omitting variadic arguments illegal , requires diagnostic. warning satisfies requirement.

javascript - The space doesn't counted in paragraph.innerHTML? -

i've been creating website can store variable whenever user type in input box. can see code below used creating website. function myfunction() { var x = document.getelementbyid("mytext").value; document.getelementbyid("demo").innerhtml = x; document.getelementbyid("mytext2").value = x; } first name: <input type="text" id="mytext" value=" mickey"> </br> </br> copy name: <input type="text" id="mytext2"> <p>click button display value of value attribute of text field.</p> <button onclick="myfunction()">try it</button> <p id="demo"></p> although code works want, found bug. here's bug, when type space several times in input box, why outcome different when stored demo paragraph has same result input box ? space counted in input box not in demo paragraph. , how make total space in

unity3d - Unity particle system only plays if i hit SIMULATE button -

i have prefab particle system attached. in code play particle using code ps.enableemission = true; when run game, , code executes, particle emitter not emit in "game" window unless press simulate button in "scene" window. anybody knows why? for emission property work particle system has playing. can either enable play on awake in particlesystem component or use play method on instance of particlesystem component. as side note, if using 5.3+ enableemission property obsolete , may want consider using emission property. 1 thing keep in mind when using property have assign variable before attempting modify it: public particlesystem _ps; ... private void update() { particlesystem.emissionmodule module = _ps.emission; module.enabled = true; } update #1 in response tractor beam example in comments suggest using setactive on game object has particlesystem component. using setactive prevent particles being emitt

c++11 - MAKEFLAGS in Qt Creator via .pro project file -

Image
the pc i'm using has 4 cores wanna use them while compiling, passing -j4 option compiler. in qt creator adding environment variable in build environment panel, shown in images: makeflags = -j4 the problem setting doesn't persist across projects in pc i'm using, cool. have each project @ least once. think stored in .pro.user file, since every time .pro.user gets deleted makeflags = -j4 desapears build environment panel. isn't possible add setting via .pro project file? i'm interested in approach allow me escape necessity of setting stuff multiple times. to give little context, i'm on windows. you're looking shared project settings in .pro.shared file. designed have in mind. adding setting .pro file wrong, since file meant portable , not tied particular build host.

xcode - Set stretching parameters for images programmatically in swift for iOS -

Image
so if want stretch parts of image, regular image or background image, use following settings in layout editor: how set programmatically? i'm using xcode 7.2.1 specifying cap insets of image you can set stretch specifics making use of uiimage method .resizableimagewithcapinsets(_:uiedgeinsets, resizingmode: uiimageresizingmode) . declaration func resizableimagewithcapinsets(capinsets: uiedgeinsets, resizingmode: uiimageresizingmode) -> uiimage description creates , returns new image object specified cap insets , options. a new image object specified cap insets , resizing mode. parameters capinsets : values use cap insets. resizingmode : mode interior of image resized. example: custom stretching using specified cap insets as example, let's try to---programmatically---stretch (current) profile picture along width, precisely @ right leg (left side viewing point of view), , leave rest of image origina

How to load a text file on a ram in VHDL? -

i have text file describing image in terms of it's rgb components want load file on fpga produce rgb signal if kind enough enlighten me thankful okey came there's problem synthesis taking forever finish, think problem here ??! library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use std.textio.all; -- uncomment following library declaration if using -- arithmetic functions signed or unsigned values --use ieee.numeric_std.all; -- uncomment following library declaration if instantiating -- xilinx primitives in code. --library unisim; --use unisim.vcomponents.all; entity rgb_gen port(clk : in std_logic; en : in std_logic; r,g,b : out std_logic); end rgb_gen; architecture behavioral of rgb_gen type ram array (0 611) of bit_vector(203 downto 0); impure function initramfromfile(filename : in string) return ram file readfile : text in filename; variable lineread : line; variable my_ram : ram; begin in

objective c - IOS delete/hide table row section and cells? -

Image
ive been struggling on couple of days trying number of different ways trying remove sections of table view. exportsettings.h @property (weak, nonatomic) iboutlet uitableviewrowaction *movemberfeatures; this connected movember section. exportsettings.m - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell* cell = [super tableview:tableview cellforrowatindexpath:indexpath]; if(cell == self.movemberfeatures) return 0; //set hidden cell's height 0 return [super tableview:tableview heightforrowatindexpath:indexpath]; } currently not building , not sure why. great if(cell == self.movemberfeatures) you trying compare uitableviewcell uitableviewrowaction . that's build fail think. you can see in documentation uitableviewrowaction defines single action present when user swipes horizontally in table row. not @ suited want do. use nsinteger associated section refer it. as suggested bhar

rust - How can I work around a RefCell issue? -

i have struct 2 c pointers , 1 rust hashmap . struct mystruct { p1: *mut ..., p2: *mut ..., hm: box<hashmap<...>> } my struct gets handled rc<refcell<mystruct>> , have c function gets called this: c_call(my_struct.borrow().p1, my_struct.borrow().p2); c has rust callback gets called during execution of c_call requires my_struct.borrow_mut() , my_struct borrowed c_call needs p1 , p2 , refcell<t> borrowed . the problem c_call can't changed , needs immutable access p1 , p2 , borrow_mut of my_struct . here's mcve: use std::cell::refcell; use std::collections::hashmap; use std::mem::uninitialized; use std::os::raw::c_void; use std::rc::rc; struct mystruct { p1: *mut c_void, p2: *mut c_void, hm: box<hashmap<string, string>> } // c_call can't mutate hm because my_struct borrowed // c_call can't changed fn c_call(_p1: *mut c_void, _p2: *mut c_void, my_struct: rc<refcell<mystruct&

google search - Android app indexing without a webpage -

is possible? want list application results using tmdb api not webpage. main target showing app results in google search application. unfortunately not possible index app content. seems if google plans support in future (it tested selected developers). can express interest using following form: https://developers.google.com/app-indexing/app-only

Custom Jenkins scheduler -

we're seeing problem jenkins , scheduling of builds. specifically, trigger jenkins build pipeline of work every push every branch of our git repo. on own, whole pipeline can take 10 20 minutes build. can cause problem if multiple pushes branch happened faster builds completing. multiplied twenty or thirty branches in development. so, i'd able automatically deprioritise scheduled builds on jenkins if triggered on git commit sha no longer tip of branch. 1 example of factor might indicate desired priority. others branches open pull requests should have higher priority without; or manual input in order prioritise pr or branch needs feedback immediately. is there anyway programmatically interact queue of jobs on jenkins , reorder it? there priority sorter plugin , far know assigns each build static priority. dynamically reprioritise items in queue based on external info (e.g. git). i've found reference two other plugins names indicate might want, can't find mea

networking - Software Routing -

"commercial software routers companies such vyatta can typically attain transfer data @ speeds of 3 gigabits per second. isn’t fast enough take advantage of full speed of typical network card, operates @ 10 gigabits per second." [1] how speed of network interface card relevant in scenario? aren't software routers connecting multiple virtual machines running on same physical host? [2] unless pc has multiple network interface cards, unlikely functions packet switch between different physical hosts. my interpretation suggests there seem exist 2 different kinds of software routing: (1) embedding real time operating system on actual router. (2) writing application layer code on pc can handle packets being transmitted between different virtual machines running on that very pc. correct? it depends on router doing. if it's literally looking @ static route table , forwarding packets out interface, there isn't hit in performance. it's when things n

Hadoop-2.7.2: appendToFile: Not Supported error -

i installed hadoop 2.7.2 independently in single node mode. i created testfile.txt content hello world in hdfs! but when want append lines file command: bin/hadoop fs -appendtofile extrafile.txt testfile.txt it throws error: appendtofile: not supported i'm using ubuntu server 14.04 on virtual machine. comment appreciated :)

python - Spark worker keep removing and adding executors -

Image
i tried build spark cluster using local ubuntu virtual machine master, , remote ubuntu virtual machine worker. local virtual machine running in virtualbox, make accessible remote guest, forwarded virtual machine's 7077 port host's 7077 port. start master by: ./sbin/start-master.sh -h 0.0.0.0 -p 7077 i made listening on 0.0.0.0 , because if use default 127.0.1.1 , remote guest won't able connect it. start worker executing following command on remote machine: ./bin/spark-class org.apache.spark.deploy.worker.worker spark://129.22.151.82:7077 the worker able connect master, can seen on ui: then tried run "pi" example python code: from pyspark import sparkcontext, sparkconf conf=sparkconf().setappname("pi").setmaster("spark://0.0.0.0:7077) sc=sparkcontext(conf=conf) .... once run it, program never stops, noticed program removing , adding executors, because executors exits error code 1. , executor's stderr : using spark'

ubuntu 14.04 - use expect to enter password when need sudo in script -

i using ubuntu 14.04 , installed expect. trying write script enter password when prompted. updated code: #!/usr/bin/expect -d set timeout 20 set pw odroid spawn sudo apt-get update expect {\[sudo]\ password odroid: } send "$pw\r" close any suggestions? thx update errors: expect: "" (spawn_id exp4) match glob pattern "\[sudo]\ password odroid: "? no [sudo] password odroid: expect: "[sudo] password odroid: " (spawn_id exp4) match glob pattern "\[sudo]\ password odroid: "? yes expect: set expect_out(0,string) "[sudo] password odroid: " expect: set expect_out(spawn_id) "exp4" expect: set expect_out(buffer) "[sudo] password odroid: " send: sending "odroid\r" { exp4 } you have many quotes. choose 1 of: expect {\[sudo\] password odroid: } expect "\\\[sudo\\\] password odroid: " clearly first option better. lots of escaping necessary because 1) squar

ios - Change "carbon.super Profile Service" to custom name -

Image
i able install wso2 emm profile. it's working on ios devices. now when install configuration profile first time displays "carbon.super profile service" profile title. how can change profile title? this identified bug in emm, have created public jira[1] , fixed soon. [1] https://wso2.org/jira/browse/emm-1473 thanks.

reactjs - Server side rendering with Swig template, React and Express -

this router set express: var r = require('rethinkdb'); var quotes = require('../model/quotes'); var user = require('../model/users'); var auth = require('../lib/auth'); var react=require('react'); var reactdomserver=require('react-dom/server') var homepage=react.createfactory(require('../component/index.js').homepage); module.exports = function(app, passport) { app.get('/', function(req, res) { if (req.user) { res.redirect('/dashboard'); } else { var homepagehtml=reactdomserver.rendertostring(homepage({})); res.render('index',{homepage:homepagehtml}); } }); } in index.html view, written in swig template engine: {% extends 'main.html' %} {% block title %}homepage{% endblock %} {% block body %} {{homepage}} {% endblock %} it renders string tags, not component created react, should make swig render component wrote

php - jQuery remote check validation -

i using jquery validation simple form has 2 selects 1- months (listing month names , value month number) 2- years (from 2016-2022) i want check selected month , year whether there record on database, mysql table has seperate month , year column. for example: how can check january 2016 in database using remote check? remote.php is $inspection_month = $_post['sm']; $inspection_year = $_post['sy']; $check_for_the_report = $db->single("select id dg_inspection_forms inspection_month = :sm , inspection_year = :sy ",array("sm"=>"$inspection_month","sy"=>"$inspection_year")); if($check_for_the_report){ echo "false"; } else { echo "true"; } the form validation part: $('.btn-new-inspection-report-save').on('click', function(e){ e.preventdefault(); $("#newinspectionreportformstep1").validate({ highlight: function(element) {

html - Experiencing different CSS results on different sites? -

i trying vertically align span-tag inside div. have working example on jsfiddle exact same css , html not work on own site. #drop_zone { width: 500px; outline: 1px solid #e1e1e1; margin: 0 auto; height: 200px; line-height: 200px; } #drop_zone span { display: inline-block; line-height: 19px; vertical-align: middle; } <div id="drop_zone"><span>drag file here.<br />your file <strong>not</strong> uploaded!</span></div> now, works on jsfiddle , on stackoverflow, why not work on own site? can check out results here: http://snorlax.org/stackoverflow.html if check source code, can see it's exact same code. on earh going on? your document missing doctype, triggering quirks mode . feature trying use works correctly in standards mode. add doctype. use validator .

android - Around Dialog everything becomes black -

i have activity opened when user clicks on it. also, (in case when game not started yet) there activity opened. activity in form of dialog. when dialog pops up, around dialog black (i want (dark) transparent). here code how start activities: private void initializebuttonstart(){ buttonstart = (button) findviewbyid(r.id.buttonstartgame); buttonstart.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(startactivity.this, gameoverviewactivity.class); startactivity(intent); if (!bussen.isgamestarted()) { intent intent2 = new intent(startactivity.this, playersettingsactivity.class); startactivity(intent2); } } }); } this way how make dialog of activity: private void setdialogwidth(){ displaymetrics metrics = getresources().getdisplaymetrics(); int screenwidth = (int) (metrics.widthpixels * dialo

oracle - Getting Repository dependencies -

i'm using informatica oracle rdbms. lately i've been struggling bit. i got assignment query dependencies between each model/workflow , desired result this: grand_model | grand_workflow | wait_4_model | wait_4_workflow dwh_model1 wf_workflow1 dwh_model3 wf_workflow3_1 dwh_model1 wf_workflow1 dwh_model4 wf_workflow4_1 dwh_model2 wf_workflow2_1 dwh_model1 wf_workflow1 which means, wf_workflow1 in model dwh_model1 waits workflow wf_workflow3_1 in model dwh_model3 etc.... we have 3 types of workflows , delta (will contains word delta ) dwh (same here) , calc (same here). workflow waits uses event contain both of models names, , workflow flags contain cmd contain grand_model name. so far we've come this: select distinct oa.subj_name grand_model, ol.subj_name wait_4_model_name, rep.workflow_name wait_4_workflow_name, a.flag_name, case when

ios - tableview not refreshing by using notificationcentre and tableview.reloaddata() -

here code use refresh tableview when click delete button on custom tableview cell using notificationcenter , tableview.reloaddata(). have searched bunch of other codes , think code looks fine. don't know why doesn't refresh. this tableview override func viewdidload() { super.viewdidload() username = tempuser.username self.resultsearchcontroller = ({ let controller = uisearchcontroller(searchresultscontroller: nil) controller.searchresultsupdater = self controller.dimsbackgroundduringpresentation = false controller.searchbar.sizetofit() self.tableview.tableheaderview = controller.searchbar return controller })() get{(value) in self.values = value ele in self.values{ if self.username != ele["username"] as! string{ } } } self.tableview.reloaddata() nsnotificationcenter.defaultcenter().addobserver(self, selector: #selector(serviceboard.

java - Auto size height for rows in Apache POI / Libre Office issue -

i creating spreadsheet using apache poi. cells have newlines, , want height of cells fits height of content. i using following code : public static void main(string[] args) throws ioexception { hssfworkbook workbook=new hssfworkbook(); hssfsheet sheet = workbook.createsheet("amap"); // sheet.autosizecolumn(0); hssfcellstyle style = workbook.createcellstyle(); style.setwraptext(true); addrow(sheet,style, (short) 0); addrow(sheet,style, (short) 1); addrow(sheet,style, (short) 2); fileoutputstream fos = new fileoutputstream("test1.xls"); workbook.write(fos); fos.flush(); fos.close(); system.out.println("ok !"); } private static hssfrow addrow(hssfsheet sheet, hssfcellstyle style, short rownumber) { // hssfrow row = sheet.createrow(rownumber); // row.setrowstyle(style); -- has no effect // row.setheight((short)-1); -- has no effect hssfcell c = row.cr

perl with xml : why to I need check if the Attribute is defined, shouldn't $node->attributes already do that? -

i'm trying use perl parse xml , i've run across seems odd. when call $node->attributes() seems return undefined value in cases. if @ line labeled problem, can see if i've added. have thought that if node had no attributes foreach wouldn't have had loop on. if uncomment if on line works. (i know put check outside loop, i'm wondering why need check @ all) #!/usr/bin/perl use strict; use warnings; $filename = 'lib.xml'; use xml::libxml; $parser = xml::libxml->new(); $parser->keep_blanks(0); $doc = $parser->parse_file($filename); sub process_node { $level = shift; $node = shift; printf ("%*s", $level, ""); print $node->nodename; print "<", $node->nodevalue,">" if (defined($node->nodevalue)); print "\n"; print "attrs:\n"; foreach ($node->attributes()){ print $_->name,":",$_->value," " ;# if (defin

r - Create list of predefined S3 objects -

i busy comparing different machine learning techniques in r. case: made several functions that, in automated way able create each different prediction model (e.g: logistic regression, random forest, neural network, hybrid ensemble , etc.) , predictions, confusion matrices, several statistics (e.g auc , fscore) ,and different plots. i managed create s3 object able store required data. however, when try create list of defined object, fails , data stored sequentially in 1 big list. this s3 object (as first time create s3, not sure code 100% correct): modelobject <- function(modelname , modelobject, modelpredictions , roccurve , auc , confusionmatrix ) { modelobject <- list( model.name = modelname, model.object = modelobject, model.predictions = modelpredictions, roc.curve = roccurve, roc.auc = auc, confusion.matrix = confusionmatrix ) ## set name class class(modelobject) <- "modelobject" return(modelobject) } at end of e

javascript - find/get specific strings between strings -

suppose, have string this "lorem ipsum dolor sit amet, [b]consectetur adipisici elit[/b], sed eiusmod tempor [i]incidunt ut labore[/i] et [size =12]dolore [/size=12] magna aliqua" i like lorem ipsum dolor sit amet, consectetur adipisici elit , sed eiusmod tempor incidunt ut labore et dolore magna aliqua". not question. question: how strings between [b]...[\b] , [i] ..[/i] or string between [size=12].. [/size=12] in textarea, when append div? text between [b][/b] should become bold , between [i][/i] should become italic , text between [size][/size] should font size... you need 2 separated pattern: to between [b] , [\b] : \[b\](.*?)\[\/b\] var str = "lorem ipsum dolor sit amet, [b]consectetur adipisici elit[/b], sed eiusmod tempor [i]incidunt ut labore[/i] et dolore magna aliqua"; var result = /\[b\](.*?)\[\/b\]/.exec(str); document.write(result[1]); to between [i] , [/i] : \[i\](.*?)\[\/i\] var str = &q

python - Conda uninstall one package and one package only -

when try uninstall pandas conda virtual env, see tries uninstall more packages well: $ conda uninstall pandas using anaconda cloud api site https://api.anaconda.org fetching package metadata: .... solving package specifications: ......... package plan package removal in environment /users/amelio/anaconda/envs/py35: following packages downloaded: package | build ---------------------------|----------------- dask-0.7.6 | py35_0 276 kb following packages removed: blaze: 0.10.1-py35_0 odo: 0.5.0-py35_1 pandas: 0.18.1-np111py35_0 seaborn: 0.7.0-py35_0 statsmodels: 0.6.1-np111py35_1 following packages downgraded: dask: 0.10.1-py35_0 --> 0.7.6-py35_0 proceed ([y]/n)? i uninstall pandas only , not have else downgraded. i understand there these packages have dependencies pandas , specific versions of pandas, possible @ conda ? parti

php - How to connect another database with model in laravel -

i able connect database this db::connection('connection_2')->table("users")->get(); but code not working user::connection('connection_2')->get(); you need set $connection property of model so: class mymodel extends eloquent { protected $connection = 'connection_2'; }

Can I Store the JavaScript Map Object in Meteor's MongoDB? -

i have following code: mymapfield = new map(); (var = stuff.length; i--; ) { mymapfield.set(stuff.id, { name: stuff.name, type: types.my_type }); } meteor.users.update(meteor.userid(), { $set: { 'profile.mymapfield': mymapfield } }); it doesn't work , error message doesn't ("undefined"). is there way store javascript map object in meteor's mongodb? i don't think there direct way insert map object mongodb of now. possible workaround can suggest : iterate on map object, and store key-value pairs separately in db the schema might this: { _id: someid, map: [{ key: key1, value: value1 },{ key: key2, value: value2 },{ key: key3, value: value3 },{ key: key4, value: value4 },{ ... }] } helper functions convert map objects format , vice-versa have written effect.

virtualenv - Django developement server module is not installed but is -

i'm try run development server byt recive error this: unhandled exception in thread started <function wrapper @ 0x807ad8848> traceback (most recent call last): file "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper fn(*args, **kwargs) file "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run autoreload.raise_last_exception() file "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 252, in raise_last_exception six.reraise(*_exception) file "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper fn(*args, **kwargs) file "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.installed_apps) file "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate a

java - receive response from http android -

i want send url such " http://192.168.1.1/key_on " html form , receive number 1 or 0 response, if can changes correctly, in app. send request asynctask, , works correctly! don't know how response ? here code in activities: button btn= (button)convertview.findviewbyid(r.id.two); btn.setwidth(500); new requesttask().execute("http://192.168.1.1/key_on"); btn.setbackgroundcolor(color.parsecolor("#ff11ac06")); btn.settext(childtext); btn.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { int color = color.transparent; drawable background = view.getbackground(); if (background instanceof colordrawable) color = ((colordrawable) background).getcolor(); if (color == color.parsecolor("#ff11ac06")) { new requesttask().execute("http://192.168.1.1/key_off"); view.setbackgroundcolor(color.parsecolor("#ff41403f")); } else { view.setbackgroundcol

UML state charts: completion transitions -

in context of uml state charts run-to-completion model, how "completion transitions" processed? the completion of state inserts "completion event" @ beginning of event queue , "completion transition" executed state machine explicitly stepped, or completion of state triggers "completion transition" (and possibly subsequent "completion transitions") , state machine may execute multiple steps each explicit stepping. both cases suggest, state's unguarded "completion transition" makes other defined transitions (whether event-triggered or guarded) redundant. am understanding correctly? the answer closer #2 ('completion of state triggers "completion transition"'), mention "multiple steps each explicit stepping." don't know mean that. the uml 2.5 spec, in section 14.2.38.3, says: a special kind of transition completion transition, has implicit trigger. event enables trig

Add additional columns to Azure Search Blob index -

we planning configure azure search index blob containers content of documents can indexed. need add additional columns such "container name" index. indexer automatically performing indexing, how customize add custom columns. you can extract container name metadata_storage_path creating field mapping (see field mappings ) uses extracttokenatposition function : "fieldmappings" : [ { "sourcefieldname" : "metadata_storage_path", "targetfieldname" : "container", "mappingfunction" : { "name" : "extracttokenatposition", "parameters" : { "delimiter" : "/", "position" : 3 } } }] the approach behind split blob path, looks " https://storageaccount.blob.core.windows.net/container/rest_of_path ", on slashes , take container, 4th token (position = 3 since positions zero-based). hth!

matlab - How to vectorize a pair-wise point inside rectangle (bounding box) check? -

Image
p m*2 matrix of m points( [x y] ), , r n*4 matrix of n rectangles ( [x1 y1 x2 y2] ). want form m*n matrix, c , in way c(i, j) indicates if i-th point in p lies inside j-th rectangle in r . single point single rect: this way check if point lies inside rectangle: c = (p(1)>=r(1))&(p(1)<=r(3))&(p(2)>=r(2))&(p(2)<=r(4)); for more readability: c = (px>=rxmin)&(px<=rxmax))&(py>=rymin)&(py<=rymax); in code above i’m sure r(1)<=r(3) , r(2)<=r(4) : r(:, [1 3]) = sort(r(:, [1 3]), 2); r(:, [2 4]) = sort(r(:, [2 4]), 2); multiple points multiple rects: it's easy mange m*1 , 1*n cases ( like second answer here ). don't know how vectorize m*n case. i’m doing using loops: m = size(p, 1); n = size(r, 1); c = false(m, n); i=1:n c(:, i) = (p(:, 1)>=r(i, 1))&(p(:, 1)<=r(i, 3))& ... (p(:, 2)>=r(i, 2))&(p(:, 2)<=r(i, 4)); end how can vectorize more efficiency? i

where to keep global variables and functions in angularjs? -

i have variables & functions in project need in every page. data in variables coming cookies & in functions calling services data.for keeping them in controller & using $rootscope global access didn't work when reload page.so should keep these variables & functions? in advance this controller code- pkcontroller.controller('domainonecontroller', [ '$scope', '$cookies', '$route', '$location', '$mdsidenav', '$rootscope', 'domainservice', 'subdomainservice', function($scope, $cookies, $route, $location, $mdsidenav, $rootscope, domainservice, subdomainservice) { /*getting username cookies display in dashboard & if not found redirect login page*/ $rootscope.role = $cookies.get('role'); $rootscope.userinfo = $cookies.get('login'); $rootscope.id = $cookies.