Posts

Showing posts from May, 2015

php - Adding ACF field to post meta -

i found code controlling posts need edit: $img = ( $mode == 'top' ) ? get_the_post_thumbnail( null, 'large' ) : get_the_post_thumbnail( null, 'medium' ); $the_image = sprintf( '<span class="c_img">%s</span>', $img ); $thumb_link = sprintf( '<a class="%s" href="%s" rel="bookmark" title="%s %s" style="%s">%s</a>', $classes, get_permalink( $post ), __( 'link to', 'pagelines' ), the_title_attribute( array( 'echo' => false ) ), $style, $the_image ); $output = ( 'top' == $mode ) ? sprintf( '<div class="full_img fix">%s</div>', $thumb_link ) : $thumb_link; return apply_filters( 'pagelines_thumb_markup', $output, $mode, $format ); } that outputs this: <span class="c_img"><img src="example image"></span> i need insert custom acf (a

python - Scrape data from reduced table -

using beautiful soup , isolating web source data inside 'p' tag, managed retrieve data need. now, i'd iterate on remaining data inside variable 'table' (over each row , each cell) scrape data list. can me how achieve this? i've read several other posts not able apply specific issue... thanks. from bs4 import beautifulsoup import urllib2 url = "http://www.gks.ru/bgd/free/b00_25/isswww.exe/stg/d000/000715.htm" page = urllib2.urlopen(url) soup = beautifulsoup(page.read(), 'html.parser') table=soup.findall('p',text=true) print(table) assuming want per-month price data, need find tr elements inside table , skip first 3 (header rows). note that, html.parser did not work me, lxml did (see differences between parsers ): soup = beautifulsoup(page, 'lxml') # requires 'lxml' installed table = soup.find("center").find("table") row in table.find_all("tr")[3:]: cells = [cell.get

python - Joining strings. Generator or list comprehension? -

consider problem of extracting alphabets huge string. one way is ''.join([c c in hugestring if c.isalpha()]) the mechanism clear: list comprehension generates list of characters. join method knows how many characters needs join accessing length of list. other way is ''.join(c c in hugestring if c.isalpha()) here generator comprehension results in generator. join method not know how many characters going join because generator not possess len attribute. way of joining should slower list comprehension method. but testing in python shows not slower. why so? can explain how join works on generator. to clear: sum(j j in range(100)) doesn't need have knowledge of 100 because can keep track of cumulative sum. can access next element using next method on generator , add cumulative sum. however, since strings immutable, joining strings cumulatively create new string in each iteration. take lot of time. when call str.join(gen) gen generator

glsl - Issues when simulating directional light in OpenGL -

Image
i'm working on opengl application using qt5 gui framework, however, i'm not expert in opengl , i'm facing couple of issues when trying simulate directional light. i'm using 'almost' same algorithm used in webgl application works fine. the application used render multiple adjacent cells of large gridblock (each of represented 8 independent vertices) meaning vertices of whole gridblock duplicated in vbo. normals calculated per face in geometry shader shown below in code. qopenglwidget paintgl() body. void openglwidget::paintgl() { glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glenable(gl_depth_test); glenable(gl_cull_face); m_camera = camera.tomatrix(); m_world.settoidentity(); m_program->bind(); m_program->setuniformvalue(m_projmatrixloc, m_proj); m_program->setuniformvalue(m_mvmatrixloc, m_camera * m_world); qmatrix3x3 normalmatrix = (m_camera * m_world).normalmatrix(); m_program->

Invalid Syntax When Creating Python Dictionary -

this part of project class on python scripting in arcgis. i have created dictionary in python script according data structure . here code have written. id = { 'name': { 'first', 'middle', 'last' }, 'age': { '22' }, 'oit': { 'title', 'address': ['strnum','street'], 'email', 'phone': ['area code', 'exchange', 'number'] }, 'home': { 'title', 'address': ['strnum', 'street'], 'email', 'phone': ['area code', 'exchange', 'number'] } } when run code says "failed run script - syntax error - invalid syntax". doens't tell me , can't seem find it. , won't let me debug either throws same error. syntax error? your dictionary riddled synta

python - Cannot import NavigationToolbar from matplotlib.backends.backend_gtk -

i'm running program received friend i'm not able solve error. initial part of code is: import matplotlib matplotlib.use('gtk') matplotlib.figure import figure matplotlib.axes import subplot matplotlib.backends.backend_gtk import figurecanvasgtk, navigationtoolbar, navigationtoolbar2gtk numpy import zeros import gtk import gtk.glade import scipy import scipy.interpolate import scipy.io when try run code, receive error: file "analeem.py", line 11, in <module> matplotlib.backends.backend_gtk import figurecanvasgtk, navigationtoolbar, navigationtoolbar2gtk importerror: cannot import name navigationtoolbar i'm running code under ubuntu, matplotlib installed. thanks in advance, matteo

save - Compiled Matlab mat file corruption -

i have compiled application cannot save user defined objects. when try load mat file in program crashes access violation error. mat file cannot loaded in matlab either (appears corrupt). however, application runs smoothly before compilation. possible causes this? classdef audio < handle properties ... end methods function self = audio() ... end end end = audio(); b = audio(); c = audio(); audiovector = [a,b,c] save(somefullpath, 'audiovector')

Getting error saying that my program has crashed in C even though it show no issue with the syntax -

i confused why program keeps on crashing. using code blocks , open source ide. here code: int main() { int age; char gender; printf("what age?\n"); scanf(" %d", age); printf("what gender? \(m/f)\n"); scanf(" %c", gender); if (age>=18){ printf("access granted! please proceed\n"); if (gender == 'm'){ printf("what's dude?"); }; if (gender == 'f'){ printf("how's going dudette?"); }; }; if (age<18){ printf("access denied. please on life.\n"); }; return 0; } scanf requires pointer variable you're setting. so, need do: scanf(" %d", &age); and similar gender

osx - password-store with git submodules -

git submodules in pass work quite using different sets of passwords. issue cannot issue git submodule commands through pass . for example, pass git submodule foreach git pull returns: fatal: /usr/local/cellar/git/2.6.4/libexec/git-core/git-submodule cannot used without working tree. as workaround, within ~/.password-store , git submodule commands work expected

mail is not sending using codeigniter php -

i want send email users when registered. have used email api send mail user. my controller code: $this->load->model('user_model'); $verify = $this->user_model->insertuser(); $this->verifymail($username,$verify); $user_data = array( 'email' => $email, 'username' => $username, 'logged_in' => true ); $this->sendmail(); $this->session->set_userdata($user_data); redirect('user/about_me'); my mail code : function sendmail() { //***************email api *********************************************************** $headers = "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "from: hp <crm@example.com>\r\n"; $headers .= "cc: hp@example.com\r\n"; $mailbox= "<pre style=\"font-family:verdana, geneva, sans-serif;\"> test </pre

linux - Why is my bash script that executes another script not exiting? -

i'm calling script bash script -- ampersand. otherscriptthatdoesnotexit & echo "done" i see getting "done" still see original script running ps. idea why be? (note, i'm running on puppy linux) the script still waiting on subprocess spawned. use nohup , disown or screen leave long running task in background , shell.

c++ - Dynamic Allocation not creating array -

i'm doing assignment school , we're doing memory management. far we're tasked create list of students + id's , we're dynamically. i'm supposed overload delete/new operators, i've done. when testing out program crash, possibly not creating array allocate information. namespace { char buffer[1024]; int allocated = 0; } struct student { int size; char *firstname; char lastname; int studentid; int occupied; student::student() : size(0) { } student::student(int s) : size(s) { std::cout << "constructor" << std::endl; std::cout << "allocated: " << allocated << std::endl; int currentloc = allocated; allocated += s; firstname = new (&buffer[currentloc]) char[s]; } void *student::operator new(size_t s) { std::cout << "operator new allocated: " << allocated << std::endl; int currentloc = allocated; allocated += s; return &buffer[currentloc]; } v

Java Play 2.4 and IDEA - Views not resolving -

Image
i doing pretty standard. trying use play-authenticate plugin, references several views won't resolve. the import there, grayed out, showing unused. build.sbt looks like: name := """webapp""" version := "1.0-snapshot" lazy val root = (project in file(".")).enableplugins(playjava, playebean) scalaversion := "2.11.6" librarydependencies ++= seq( javajdbc, cache, javaws, "com.feth" % "play-authenticate_2.11" % "0.7.1", "org.postgresql" % "postgresql" % "9.4-1206-jdbc42", "org.webjars" % "bootstrap" % "3.2.0", "be.objectify" % "deadbolt-java_2.11" % "2.4.4" ) // play provides 2 styles of routers, 1 expects actions injected, // other, legacy style, accesses actions statically. routesgenerator := injectedroutesgenerator fork in run := true i have tried restarting intellij, running

java - Algorithm to find the narrowest intervals, m of which will cover a set of numbers -

let's have list of n numbers. allowed choose m integers (lets call integer a ). each integer a , delete every number within inclusive range [ a - x, + x ], x number. minimum value of x can list cleared? for example, if list of numbers 1 3 8 10 18 20 25 and m = 2, answer x = 5. you pick 2 integers 5 , 20. clear list because deletes every number in between [5-5, 5+5] , [20-5, 20+5]. how solve this? think solution may related dynamic programming. not want brute force method solution. code helpful, preferably in java or c++ or c. a recursive solution: first, need estimation, can split in m groups, estimated(x) must ~ (greather - lower element) / 2*m. estimated(x) solution. if there better solution, has lower x extimated(x) in groups! , can check first group , repeat recursively. problem decreasing until have group: last one, know if new solution better or not, if there'is better, can use discard worse solution. private static int estimate(int[] n,

mysql - How can I get my database to update more than once in this "foreach" loop, using PHP? -

this in php web page. i have link user lands on example: www.example.com/update?attend=1&code[]=4321&code[]=5642&code[]=1842 need update: foreach code attend=1 . my code far: ...database connect information... $codes = $_get['code']; $invitecode = $_get['invitecode']; foreach ($codes $code) { print $code; ?><br><?php $sql = "update guests set attend='$isattend' invitecode=$code"; } ...database close , result... renders as: 4321 5642 1842 record updated when check database last value 1842 set attend=1 . prints correct updates one? does understand doing wrong here? you can execute each sql in foreach better use in clause.so code hit database 1 time.

html - Put divs or spans in td's -

Image
i have basic table td 's. i want able put coming sign on top of td . have got coming sign done both divs , spans , need both in make coming sign. but can't put coming on text in td . current result end on different lines . how can put text , coming on top of each other using css? the wanted result similar minecraft home page: note: coming sign rotated can told apart. table{ width: 100%; background: lightblue; } .header{ text-align: center; background: lightblue; padding: 30px; margin: 0; } table, th, td, .header { border: 1px solid black; border-collapse: collapse; } th, td { padding: 5px; text-align: left; } <table> <h2 class="header">comming soon</h2> <tr> <td>jill</td> <td>smith</td> <td>50</td> </tr> <tr> <td>eve</td> <td>jackson</td> <td>94&

combinations - Given a sorted array find number of all unique pairs which sum is greater than X -

is there solution can achieved complexity better o(n^2)? linear complexity best o(nlogn) great. i've tried use binary search each element o(nlogn) im missing something. for example, given sorted array: 2 8 8 9 10 20 21 , number x=18 [2,20][2,21][8,20][8,21][8,20][8,21][9,10][9,20][9,21][10,20][10,21][20,21] function should return 12. help! for problem, given set of numbers, there may which, included other number, guaranteed solution because in greater target amount summing. identify those. combination of solution. example-data, 21 , 20 satisfy this, combinations of 21, six, , remaining combinations of 20, five, satisfy requirement (11 results far). treat sorted array subset, excludes above set (if non-empty). from new subset, find numbers can included number in subset satisfy requirement. starting highest (for "complexity" may not matter, ease of coding, knowing have none helps) number in subset, identify any, remembering there need @ least 2 such

php - Current time when MySQL record is saved to database -

i'm working zend framework 1.12 , mysql. want add column in database, save currenct datetime when record inserted table. anyone knows how can defined column? function must working on mysql site, not php. you must change column type timestamp , , in default field set current_timestamp

WebStorm FTP deployment: 'could not put ftp file' -

i added ftp deployment server "passive mode" on in webstorm. it runs when downloading files server fails error when uploading files: [16.01.16, 13:02] failed transfer file '/users/vic/sites/gulpfile.js': not put ftp file "ftp://ver.blabla.ru/www/gulpfile.js". does know can problem? you can : change mode ftp 'active' 'passive' inspect right of directory ftp use sftp otherwise ftp

R, class() returns different results for data frame columns -

> bb = data.frame(x = c( 11:13), y = c(1:3), z = c("a", "a", "b")) > bb x y z 1 11 1 2 12 2 3 13 3 b > > apply( bb, 2, class) x y z "character" "character" "character" > > apply( bb[,1:2], 2, class) x y "integer" "integer" > > apply( bb[,2:3], 2, class) y z "character" "character" > > class(bb$z) [1] "factor" > i quite surprised find class() behavior illustrated above.could please give rationale above inconsistencies. many thanks. the reason apply converts character class converts matrix , matrix can hold single class i.e. if there @ least 1 column non-numeric, entire dataset gets changed character . instead, use, lapply(bb, class) #$x #[1] "integer" #$y #[1] "integer" #$z #[1] "factor" the above returns out

PHP trying to work with classes, but class can't be accessed -

i'm trying create class function in 1 php file, , access another. can't work. fatal error: class 'databaseconnect' not found . the code: <?php $conn = new mysqli("localhost", "root", "usbw", "beoordelingen") or die(mysql_error()); class database { public function getdatabase($thevar, $theselector, $thelocator) { $thevar = $conn->query("select $theselector beoordeling $thelocator"); } } ?> then trying call in file: <?php include("myclassfile.php"); $index = new database(); $index->getdatabase($result, "distinct `category`"); ?> does have scope or namespace? or doing wrong here. (1) check whether file exists. you'd better use absolute path well. (2) whether there namespace scope. try new \databaseconnect(); append back-slash

Does an Android SQLite database persist after switching the device off? -

i want develop android app. input user , store in phone's database. my data should retained in phone if phone gets switched off. possible using sqlite database? android provides several options save persistent application data. solution choose depends on specific needs, such whether data should private application or accessible other applications (and user) , how space data requires your data storage options following: shared preferences store private primitive data in key-value pairs. internal storage store private data on device memory. external storage store public data on shared external storage. sqlite databases store structured data in private database.

java - Constructor method must contain all instance variables -

many times i'm faced class constructor method must contain list of arguments identical list of class instance variables. as see in example there "some" code make hapend. i'm wondering how can make process less painful? example: public class vimeouser extends schema { @getter @setter private string uri; @getter @setter private string name; @getter @setter private string link; @getter @setter private string location; @getter @setter private string bio; @getter @setter private string createdtime; @getter @setter private string account; @getter @setter private map<string,integer> statistics = new hashmap<>(); @getter @setter private list<website> websites = new arraylist<>(); @getter @setter private list<portrait> portraits = new arraylist<>(); public vimeouser( string uri, string name, string link, string location, stri

scala - Restricting generic type to an enumeration type -

say want define generic type , have guarantee instantiated when generic parameter 1 of known list of types. 1 way that, using typeclasses, is sealed trait allowed[a] object allowed { implicit object string extends allowed[string] implicit object int extends allowed[int] } case class player[a: allowed](id: a, name: string, score: double) in case, know player can have id string or int , nothing else. can leverage information in functions such following def retrieveplayerbyid[a: allowed](p: player[a]) = implicitly[allowed[a]] match { case allowed.string => val id = p.id.asinstanceof[string] ... case allowed.int => val id = p.id.asinstanceof[int] ... } now, problem following. same, allowing generic parameter either string , or enumeration type. i not care if enumerations encoded this: object weekday extends enumeration { type weekday = value val mon, tue, wed, thu, fri, sat, sun = value } or this trait weekday case obj

c# - How to optimize SQL query generated by Entity Framework in SQL Server Management Studio? -

i create query in linq returns table of active salesmen in shop: projectdb3context db = new projectdb3context(); db.database.log = message => trace.writeline(message); var result = db.tblusers.join(db.tblsales, u => u.id, sl => sl.tbluserid, (u, sl) => new { u, sl }) .select(o => new { userid = o.u.id, login = o.u.userlogin, fullname = o.u.name + " " + o.u.surname, itemstosell = db.tblsales.where(x => x.tbluserid == o.u.id).count() }) .distinct() .orderbydescending(x => x.itemstosell) .tolist(); the henerated sql query looks like: select [distinct1].[c1] [c1], [distinct1].[id] [id], [distinct1].[userl

Android support lib v4 or v13 -

i have developed android application build using api 13 , min-sdk api 13. want incorporate swiping across tabs, , purpose using v4 support library . i have following questions, which support library should use v4 or v13? should change target api 14? more importantly how decide, should targeted api compile against? for question 1: @stinepike said, depending on use minimum, should use v4 min-sdk = 4-12 if min sdk >=13 ok use v13. for question 2: best target depends on plan do, if want provide features introduced in higher sdk level, have use higher target-sdk make sure check android version not use android apis introduced in higer sdk version on device older android version if(build.version.sdk_int >= build.version_codes.honeycomb) { // safe use api 11 / android 3.0 stuf } else { // use api level <= 10 stuff } for min-sdk same. if require stuff of api level >= 10 have use min-sdk 10 my opinion: don't use api level < 10, not worth it.

perl - Unable to generate ExpatXS.dll from XML-SAX-ExpatXS-1.31 package for Windows -

i encountered error when running app on windows. after r&d, discovered needed expatxs.dll missing component here(loadable object module) can't locate loadable object module xml::sax::expatxs in @inc (@inc contains : c:/perl/site/lib c:/perl/lib .) @ (eval 63) line 1 compilation failed in require @ (eval 63) line 1. so, have strawberry perl installed on x86 machine , have xml-sax-expatxs-1.31 package contains makefile.pl , header file encoding.h , expatxs.pm file guess perl module required generate expatxs.dll(am right ?) can please let me know how should compile package expatxs.dll windows. main aim generate expatxs.dll windows. is related using cpan? don't know it. so, please explain in layman's terms. thanks in advance. just cpan xml::sax::expatxs

c++ - How to make CLion insert generated code.... in .cpp files -

generating code in clion result in having methods implemented in header files, i've been taught should go in .cpp files, how can change behavior , possible ? example : in project containing main.cpp , test class (test.hpp, , test.cpp). the cmake file follow: cmake_minimum_required(version 3.3) project(testclion) set(cmake_cxx_flags "${cmake_cxx_flags} -std=c++11") set(source_files main.cpp test.cpp test.hpp) add_executable(testclion ${source_files}) (note default file provided clion, haven't changed anything) test.hpp #ifndef testclion_test_hpp #define testclion_test_hpp class test { protected: int test; }; #endif //testclion_test_hpp test.cpp #include "test.hpp" pressing alt + insert , generating getters/setters while being in test.hpp or test.cpp changes test.hpp: test.hpp #ifndef testclion_test_hpp #define testclion_test_hpp class test { public: int gettest() const { return te

apache - Can't Access to my Amazon Instance with public Ip -

i have new amazon instance ec2, , want build web server did : install apache2 install libapache2-mod-php5 a2enmod rewrite add http rule in default group allow ip add directory allowoverride in /etc/apache2/sites-availables/ default-conf but when want check if apache running typing public ip of instance in browser, dont have basic index.html "it's works". got nothing. what missed ? thanks you. if apache running fine, might firewall. in aws console, make sure have unblocked port 80 in "security groups" under "network & security".

Love2D, LUA Tween resetting -

i have problem tweening. using tween.lua move character left or right when button held. on release player returns middle. tweening works when character goes either left or right but, reason when has go middle character warps there , not tween. suspect either base x overriding or not resseting @ right moment. here code: --local variables local lg = love.graphics local lk = love.keyboard function player:load(arg) --player load function. called when loaded. self.img = lg.newimage(currentpimg) playerwidth = player.img:getwidth() --gets player image width , sets variable self.mid = width/2 - playerwidth/2 self.left = 100 - playerwidth/2 self.right = width - 100 - playerwidth/2 self.x = player.mid self.y = height-150 self.speed = 0.04 gomid = tween.new(player.speed , player, {x=player.mid}, 'linear') goleft = tween.new(player.speed , player, {x=player.left}, 'linear') goright = tween.new(player.speed , player, {x=player.ri

not assignable to 'android.app.activity' extends application -

i implementing adobe creative sdk. getting following error in in my manifest file: 'com.example.nick.avierytest2.mainactivity not assignable android.app.activity' this xml file: <?xml version="1.0" encoding="utf-8"?> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" android:theme="@style/apptheme.noactionbar" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> this main activity class:

ruby - Rails not finding rake-10.5.0 -

i trying install rake gem in rails 4.2. th gem seems install fine, rails fails when tries run, saying cannot see rake-10.5.0 . developing in rubymine , error getting below, gemfile. have tried deleting gemfile.lock suggested other posts, no avail. console: ~/development/rubymineprojects/revenant.tech  ls gemfile rakefile config lib test gemfile.lock app config.ru log tmp readme.rdoc bin db public vendor ~/development/rubymineprojects/revenant.tech  gem install rack installed rack-1.6.4 parsing documentation rack-1.6.4 done installing documentation rack after 2 seconds 1 gem installed ~/development/rubymineprojects/revenant.tech  bundle update rake fetching gem metadata https://rubygems.org/........... fetching version metadata https://rubygems.org/... fetching dependency metadata https://rubygems.org/.. resolving dependencies... using rake 10.5.0 using i18n 0.7.0 using json 1.8.3 using minitest 5.8.3 using thread_safe

Sort PDF pages by shell script -

i'd scan huge documents using adf of scanner. because not duplex adf, cannot automatically scan two-sided pages. is: scan odd pages. scan pages. what pdf file page number pattern: 1 3 5 2 4 (how) can sort pdf using shell script? there pattern, should possible. this might started. first extract pages separate files. filenames in bash array. sort array. recombine pages. #!/bin/bash # extract pages "orig-000.png", "orig-001.png" pdfimages -png "$1" orig # make array of names of pages orig=($(ls orig-*png)) echo extracted pages: echo @{orig[@]} npages=${#orig[@]} echo pages: $npages # ii = input index # oi = output index halfway=$(echo "($npages-1)/2" | bc) oi=0 for((ii=0;ii<npages;ii++)); [[ ii -eq $halfway ]] && oi=1; echo $ii,$oi out[oi]=${orig[ii]} ((oi+=2)) done echo sorted pages: echo ${out[@]} # reassemble pages - suggesting imagemagick's "convert" os may have better t

Understanding of how for loops in C relate to IA32 machine code -

foo: pushl %ebp movl %esp,%ebp movl 12(%ebp),%ecx xorl %eax,%eax movl 8(%ebp),%edx cmpl %ecx,%edx jle .l3 .l5: addl %edx,%eax decl %edx cmpl %ecx,%edx jg .l5 .l3: leave ret i know xorl indicator of cycle (int i=0), can't understand rest of code... can give me hint? thanks! function foo has 2 parameters, let's call them x , y . foo: # foo(x, y) pushl %ebp movl %esp,%ebp movl 12(%ebp),%ecx # ecx = y xorl %eax,%eax # eax = 0 movl 8(%ebp),%edx # edx = x cmpl %ecx,%edx # while (ecx < edx) { jle .l3 .l5: addl %edx,%eax # eax += edx decl %edx # edx-- cmpl %ecx,%edx # } jg .l5 .l3: leave ret # return eax hope helps.

generics - Set of weak observers in Swift -

i trying implement structure allows me store set of weak observers. here observer wrapper: public func ==<t: hashable>(lhs: weakobserver<t>, rhs: weakobserver<t>) -> bool { return lhs.hashvalue == rhs.hashvalue } public struct weakobserver<t t: anyobject, t: hashable> : hashable { private weak var weakobserver : t? public init(weakobserver: t){ self.weakobserver = weakobserver } public var hashvalue : int { return self.weakobserver!.hashvalue } } and here protocol every observer needs conform to: public protocol datamodelobserverprotocol : class, hashable, anyobject { func somefunc() } usage: public class datamodel: nsobject, datamodelinterface { public var observers = set<weakobserver<datamodelobserverprotocol>>() //^^^^^ using 'datamodelobserverprotocol' concrete type conforming protocol 'anyobject' not supported } now, while aware might limitation swift itself, looking alternat

python - Scikit-learn, Numpy: Changing the value of an read-only variable -

i'm using scikit-learn train svm . after train model on data, want change coef_ of model. #initiate svm model = svm.svc(parameters...) #train model data model.fit(x,y) #now want change coef_ attribute(a numpy array) model.coef_ = newcoef problem: gives me attributeerror: can't set attribute . or when try access numpy array in attribute gives me valueerror: assignment destination read-only . is there way change attributes of existing model? (i want because want parallelize svm training, , have change coef_ attribute this.)

c# - Could not instantiate event handler. Type: Sitecore.Publishing.HtmlCacheClearer -

it of sudden , stopped working. have no clue went wrong, caused occur: could not instantiate event handler. type: sitecore.publishing.htmlcacheclearer. method: clearcaches (method: sitecore.events.event+eventsubscribers.add(string eventname, xmlnode confignode)). i tried make work didn't re-copied sitecore files sitecore 7.2 re-indexed solr created new sitecore project republished complete site banged head on desk can tell me reason , solution. new sitecore. updating publish:end , publish:end:remote <event name="publish:end"> <handler type="sitecore.publishing.htmlcacheclearer, sitecore.kernel" method="clearcaches"> <sites hint="list"> <site>website</site> </sites> </handler> </event> <event name="publish:end:remote"> <handler type="sitecore.publishing.htmlcacheclearer, sitecore.kernel" method=&quo

sql - Order Tables Schema Issue -

i have 2 tables order_primary , order_complete problem when want generate bill there multiple products in bill in order_primary table, generate orderid each single product though same bill, how should associate these orderid in order_complete table there multiple orderids same product there has 1 billno order_primary orderid (primary key) productid (foreign key) categoryid (foreign key) quantity cost employeeid (foreign key) order_complete billno (primary key) orderid (foreign key) date to desired result have change data-structure this: product_group (add new table) productid (foreign key) productgroupid productgroupid+productid (primary key) order_primary orderid (primary key) productgroupid ^(now here productgroupid list of products(multiple)) categoryid (foreign key) quantity cost employeeid (foreign key) order_complete billno (primary key) orderid (foreign key) date

c - How to retrieve a variable from the Apache configuration inside the module? -

i'm building custom apache module. how retrieve variable apache configuration inside module? see variable "some_var_config_from_apache_or_htaacess" inside apache module: /* source: http://people.apache.org/~humbedooh/mods/examples/mod_example_1.c */ /* include required headers httpd */ #include "httpd.h" #include "http_core.h" #include "http_protocol.h" #include "http_request.h" static void register_hooks(apr_pool_t *pool); static int example_handler(request_rec *r); /* define our module entity , assign function registering hooks */ module ap_module_declare_data example_module = { standard20_module_stuff, null, // per-directory configuration handler null, // merge handler per-directory configurations null, // per-server configuration handler null, // merge handler per-server configurations null, // directives may have httpd register_hoo

java - How to allow FTP Clients to create new directories on an Apache FTP Server in Android? -

i developing apache ftp server android app. able connect ftp server filezilla can't create new directories or upload datas on server , seems there doesn't exist directory though created one. here's mainactivity.java file in declare ftp server , baseuser , set writepermission user: package com.example.adminklui.server; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.view.menu; import android.view.menuitem; import org.apache.ftpserver.ftpserver; import org.apache.ftpserver.ftpserverfactory; import org.apache.ftpserver.ftplet.authority; import org.apache.ftpserver.ftplet.ftpexception; import org.apache.ftpserver.ftplet.usermanager; import org.apache.ftpserver.listener.listenerfactory; import org.apache.ftpserver.usermanager.propertiesusermanagerfactory; import org.apache.ftpserver.usermanager.saltedpasswordencryptor; import org.apache.ftpserver.usermanager.

php - Import Dataflow Profile not importing product correctly -

Image
i'm trying import product magento using dataflow profiles . after uploading , running file, successful message, don't see products under admin->catalog->manage products . went database see if appeared in catalog_product_entity . appears, sku null (it isn't null in csv file). suspect why it's not showing in admin->catalog->manage products , when change sku still doesn't show up. have following: dataflow profile success message database screenshot - entity_ids 9-20 attempts i've tried following: changing sku value in database other null cleared cache , reindexed confirmed image imported each time tried import. i confirmed of fields imported database, such type . don't know other fields prevent image showing in manage products . anyone know possible reason? 1 - after make changes directly db should clear cache , ro reindex in magento 2 - if use excel csv - magento profile should have csv seperator se

linux - Saving GPU memory by bypassing GUI -

i have mac book pro 2 gb nvidia gpu. trying utilize gpu memory computations (python code). how saving may if bypassed gui interface , accessed machine through command line. want know if such thing save me amount of gpu memory? the difference won't huge. a gpu hosting console display typically have ~5-25 megabytes of memory reserved out of total memory size. on other hand, gpu hosting gui display (using nvidia gpu driver) might typically have ~50 megabytes or more reserved display use (this may vary based on size of display attached). so can "estimate" of savings running nvidia-smi , looking @ difference between total , available memory gpu gui running. if is, example, 62mb, can "recover" around 40-50mb shutting off gui, example on linux switching runlevel 3. i ran experiment on linux laptop quadro3000m happens have 2gb of memory. x display , nvidia gpu driver loaded, "used" memory 62mb out of 2047mb (reported nvidia-smi ). wh

What exactly does this Hadoop command performed in the shell? -

i absolutly new in apache hadoop , following video course. so have correctly installed hadoop 1.2.1 on linux ubuntu virtual machine. after installation instructor perform command in shell: bin/hadoop jar hadoop-examples-*.jar grep input output 'dfs[a-z.]+' to see hadoop working , correctly installed. but command? this command runs grep job defined inside hadoop examples jar file (containing map, reduce , driver code) input folder search specified in input folder in hdfs while output folder output after searching patter in file while dfs[a-z.]+ regular expression saying grep in input.

php - How do I fix and call this function every second? -

i have pasted code below can't seem work. i'd achieve when types in username box, i'd echo below, i'd function check field every second. thank you! name: <input type="text" name="username" /><br /> <?php $username = $_get['username']; function functionname() { echo '<p>id: ',$username, "</p>"; } functionname(); ?> php isn't right language that, want in javascript achieve this. have @ question detecting input change in jquery?

unit testing - mocking a angularjs value to be reused within different tests -

have angularjs service makes use of angular value store username. (function() { 'use strict'; angular.module('myapp.services', []) .service('authservice', authservice) .value('authstore', { username: null }); authservice.$inject = ['authstore']; function authservice(authstore) { var svc = this; var _username = authstore.username; svc.isloggedin = isloggedin; svc.logout = logout; svc.login = login; svc.getusername = getusername; function isloggedin() { return _username != null && _username && _username != ''; } function logout() { authstore.username = null; _username = null; } function getusername() { return _username; } function login(username) { authstore.username = username; _username = username; } } })(); and i'm using jasmine try , test isloggedin method. tests be; (function ()

variable doesn't retain value in JavaScript -

alert("bienvenue dans le gestionnaire des contacts !"); alert("1 : lister les contacts\n2 : ajouter un contact\n0 : quitter\n"); var contacts = { nom: function(nom) { this.nom = nom; }, prenom: function(prenom) { this.prenom = prenom; } }; var personne1 = object.create(contacts); personne1.nom("lévisse"); personne1.prenom("carole"); var personne2 = object.create(contacts); personne2.nom("nelsonne"); personne2.prenom("mélodie"); var contacts = []; contacts.push(personne1); contacts.push(personne2); var i; var boucle = 1; var choix = 1; while (boucle == 1) { var choix = prompt("entrez une valeur :"); if (choix === 1) { alert("voici la liste de tout vos contacts : "); (i = 0; < contacts.length; += 1) { alert("nom : " + contacts[i].nom + ", prenom : " + contacts[i].prenom + "\n"); } } else if