Posts

Showing posts from July, 2012

symfony 2.5 use ClassLoader to add Zend_pdf -

i'm working in symfony 2.5 , want use zend framework pdf (zend_pdf) i tried classloader wrong because doesn't work (of course)... i don't know add classloader... thought in autoload.php not know how... autoload.php, standard one: <?php use doctrine\common\annotations\annotationregistry; use composer\autoload\classloader; /** * @var classloader $loader */ $loader = require __dir__.'/../vendor/autoload.php'; annotationregistry::registerloader(array($loader, 'loadclass')); return $loader; i tried adding in controller this: use symfony\component\classloader\classloader; /** * @template() */ public function pdfaction() { $loader = new classloader(); $loader->addprefix('zend', __dir__.'/vendor/zf/library'); $loader->register(); $pdf = new \zend\pdf\zend_pdf(); .... but says: attempted load class "zend_pdf" namespace "zend\pdf". did forget "use" statement nam

php - .htaccess redirect from subfolder to root keeping paths -

i'm migrating site need redirect content www.oldurl.com/subfolder www.newurl.com , keep links, example: www.oldurl.com/subfolder/subfolder2 needs redirect www.newurl.com/subfolder2 and www.oldurl.com/subfolder/subfolder3/link.html needs redirect www.newurl.com/subfolder3/link.html my .htacess looks this: rewriteengine on rewriterule ^subfolder/(.*)$ /$1 [r=301,l] it redirecting www.oldurl.com/subfolder www.newurl.com/ not follow old paths sends request home page for new conditions new .htaccess rewriteengine on rewriterule ^subfolder/(.*)$ http://www.newurl.com/$1 [r=301,l]

ios - Core Data Predicate SQL Unable to Parse -

Image
i've been banging head on getting filtering statement work. i've tried bunch of things (as can see in commented code). trying do search when user typing - searches customerobject.firstname, customerobject.lastname, , title - if phrase in of these show results. .lastname , .firstname properties of customerobject. class func searchcontainspredicateestimateinvoice(searchstring: string, existingpredicate: nspredicate? = nil) -> nspredicate { var words = searchstring.componentsseparatedbystring(" ") var predicatelist = [nspredicate]() word in words { if count(word) > 0 { var str = nsstring(format: "subquery(%@, $f, $f.%@ contains[cd] %@) or subquery(%@, $l, $l.%@ contains[cd] %@) or (%@ contains[cd] %@)", "\(customer_object_key)","\(user_first_name_local_key)" ,word, "\(customer_object_key)", "\(user_last_name_local_key)", word, estima

node.js - Ajax call on page load in Node application -

trying make ajax call on page load. below code snippet. in app.js app.get('/', function(req, res) { res.render('index',{'a':1,'b':2}); //res.send({'a':1,'b':2}); }); in main.js (function(){ $.ajax({ url: '/' , type: 'get' }) .done(function(data) { console.log(data); }); })(); ovbiously call going wrong here (data coming wrong). can please me understand concept going wrong here ! apreciate . change app.js so: app.get('/', function(req, res) { res.json({'a':1,'b':2}); });

python - Convert string to float SQLAlchemy -

is there way convert string float when reading database? column size consists of string values (i.e. "45" ) how value float when query db using sql alchemy. i know easiest way float(value) if value null need deal catching exception, etc. there quick way in sqlalchemy? example: give me float value if exists else return none create column type conversion , database you. see documentation typedecorator . from sqlalchemy import string sqlalchemy.types import typedecorator class stringfloat(typedecorator): impl = string def process_literal_param(self, value, dialect): return str(float(value)) if value not none else none process_bind_param = process_literal_param def process_result_value(self, value, dialect): return float(value) if value not none else none this assumes values in database either valid floats or null . if there other strings, add try block around float() call. use type rather string or float when

matlab - Solving ode45 with a time dependent parameter in one differential equation -

i modeling ecosystem in isle royale, , have differentia equation looks this: function dydx = project1(t, y) w = y(1); m = y(2); t = y(3); f = y(4); r = y(5); gw = 2; gm = 10; gt = 0.7*10; gf = 0.6*10; pr = 1000; dw = 5; dm = 1; dt = 0.7; df = 10; km = 1; kf = 50; kr = 10; kt = 0.2; dydx = zeros(5, 1); dydx(1) = gw*km*w*m-dw*w; dydx(2) = gm*kf*m*f-dm*m-km*m*w-kt*m*t; dydx(3) = gt*t*m-dt*t; dydx(4) = gf*kr*f*r-df*f-kf*f*m; dydx(5) = pr-kr*r*f-kr*r; i want last dif equation, dydx(5), dr/dt = pr*t-(other stuff). i've tried t defined above, , y, none seems work. pr production rate of resources, , depends on time. how can incorporate time dependency?

swagger - Is it possible to define a parameter set and reference it? -

i have multiple parameters want reference, not want specify them 1 one. this snippet not make parameters show up: { ... "paths": { "/stuff": { "get": { "description": "gets stuff", "operationid": "getstuff", "parameters": { "$ref": "#/definitions/set1" } } } }, "parameters": { "a": { "name": "a", "in": "query", "description": "param a", "required": false, "type": "string" }, "b": { "name": "b", "in": "query", "description": "param b", &

python - winsound stops ongoing animation -

i'm newer python, , new tkinter, , need playing sound every time ball in screen moves. code have def leftmove(event): canvas.move(circle_item2, -5, 0) x1, y1, x2, y2 = canvas.coords(circle_item) winsound.playsound('doorslam.wav',winsound.snd_filename) rightmove(event): canvas.move(circle_item2, 5, 0) x1, y1, x2, y2 = canvas.coords(circle_item) def upmove(event): canvas.move(circle_item2, 0, -5) canvas.after(.1, upmove) def downmove(event): canvas.move(circle_item2, 0, 5) x1, y1, x2, y2 = canvas.coords(circle_item) root.bind('<left>',leftmove) root.bind('<right>',rightmove) root.bind('<up>',upmove) root.bind('<down>',downmove) the problem every time press left key, stops animation until sound done playing. proper way make both play @ same time? play sound in separate thread, this: playsound = lambda: winsound.playsound('doorslam.wav',winsound.snd_filename) t = threading.t

python - pandas mean function returning NaN -

i know may newbie question, please forgive me, have not found answer seems make sense to/help me. importing data .csv file , need slice out particular part. have done , when print data frame , values need present. df = pd.read_csv('c:/users/owner/desktop/df.csv') dfr = df[44:58] #rows need dfrc = dfr[['1','2','3','4','5']] #columns need dfrc.mean(axis=1 skipna=true) #there nans present in last index what returned 44 nan ... 57 nan dtype: float64 i not sure why is, need numerical value mean of index/row. hoping on forum able help. thank you. are sure data numeric (int or float)? maybe should try cast columns before, , see if error raised. dfrc = dfrc.astype(float)

swift - How to change the format in which google analytics reports exceptions in iOS? -

i'm integrating google analytics ios application , want google analytics track uncaught exceptions. this, use line: gai.sharedinstance().trackuncaughtexceptions = true when using automatic exception measurement, official documentations says: by default, description field automatically set using exception type, class name, method name , thread name. my question is: there way changing behavior. mean, how can set custom value description field? gai intercepting un-handled exception , processing exception raise fatal exception ga hit. if wanted override this, wouldn't able use automatic tracking, instead you'd have capture , parse exception yourself, , manually raise event. here's blog post showing how might handle exception: http://www.cocoawithlove.com/2010/05/handling-unhandled-exceptions-and.html

php - Creating user in Laravel 5 -

so following angular/laravel 5 tutorial using json web tokens. running issue. here how says create user: route::post('/signup', function () { $credentials = input::only('email', 'password','name'); try { $user = user::create($credentials); } catch (exception $e) { return response::json(['error' => 'user exists.'], illuminate\http\response::http_conflict); } $token = jwtauth::fromuser($user); return response::json(compact('token')); }); the problem is, user::create($credentials); not encrypt password, meaning, logins fail. found out using laravel's default registration. my question is, how create new user creates correct way? you have hash password using hash helper class . try this: route::post('/signup', function () { $credentials = input::only('email', 'password','name'); $credentials['password'] = hash::make($creden

java - How to join items of list, but use a different delimiter for the last item? -

given list like: list<string> names = lists.newarraylist("george", "john", "paul", "ringo") i'd transform string this: george, john, paul , ringo i can rather clumsy stringbuilder thing so: string namelist = names.stream().collect(joining(", ")); if (namelist.contains(",")) { stringbuilder builder = new stringbuilder(namelist); builder.replace(namelist.lastindexof(','), namelist.lastindexof(',') + 1, " and"); return builder.tostring(); } is there bit more elegant approach? don't mind using library if needed. notes : i use old for loop index, not looking such solution there no commas within values (names) as did of introduce second method "replacelast" not in jdk java.lang.string far: import java.util.list; import java.util.stream.collectors; public final class stringutils { private static

Rails 4 partial with form not rendering -

i have partial file _form.erb.html : <p>name: </p><%= f.text_field :name %> <p>description: </p><%= f.text_field :description %> <p>price: </p><%= f.text_field :price %> <p>weight: </p><%= f.text_field :weight %> and view file items/new.html.erb : <h1>new item</h1> <%= form_for @item |f| %> <% render partial: 'form', locals: { :f => f} %> <p><%= f.submit 'create' %></p> <% end %> but, when go 0.0.0.0:3000/items/new see page without form , no errors displayed. i'm doing wrong? you missing = . should <%= render partial: 'form', locals: { :f => f} %>

elasticsearch - Logstash unable to start when I add grep filter -

i have logstash instance deployed on local , trying head wrapped around it. added simple grep filter logstash.conf file, when restart service, fails. , when remove grep statement works fine. here config. appreciated. thanks. input { kafka { zk_connect => "localhost:9091" topic_id => "rawlog" reset_beginning => false consumer_threads => 1 consumer_restart_on_error => true consumer_restart_sleep_ms => 100 decorate_events => false } } output { elasticsearch { bind_host => "localhost" protocol => "http" } } filter { grep { match => {"message"=>"hello-world"} } } grep{} deprecated in favor of conditionals , drop{}: filter { if [message] !~ /hello-world/ { drop{} } } if doesn't help, post sample of input.

linux - Android version and its kernel -

i'm trying port android lollipop board , such require modified kernel written (simple modifications, nothing major). however can't find information anywhere says minimum required kernel version build android 5.0 or greater. for instance i've made required adjustments linux 3.18 has corresponding version android kernel version. if can answer question appreciated. i'm not aware of place officially specifies minimal kernel version particular android version. devices running lollipop know, nexus 7 has oldest kernel - 3.1. if check https://android.googlesource.com/kernel/tegra.git git repository, there example android-tegra3-grouper-3.1-lollipop-mr1 branch based on kernel 3.1 , seems lollipop. of devices (also working on lollipop) work run on kernel 3.4, , few on 3.10. i remember reading small features introduced in lollipop available if have kernel 3.10 or newer can't find details now. i'll update answer if find again.

algorithm - highest parallel event time -

i've had interview question , know how solve that: have tried find answer on google , here no success "given long list of events start point , end point, find time intersection highest " not allowed use complex data structure thank sort times ascending order , run along them, incrementing counter @ start , decrementing @ end. time highest intersection should time when counter reached highest value.

javascript - Change style of textnode but not child nodes -

i trying make collapsible hierarchy. in trying highlight place user expanding. tried set font-weight property bold highlight. highlight childern also. <ul> <li id="a">a <ul> <li id="a_1">1</li> <li id="a_2">2 <ul> <li id="a_2_2.1">2.1</li> <li id="a_2_2.2">2.2</li> </ul> </li> </ul> </li> </ul> what trying here if user selects a>2>2.2 . highlight textnode of 3 li nodes. $('li').on('click', function (event) { event.preventdefault(); $('ul:first',event.target).toggle("slow"); document.getelementbyid($(event.target).attr("id")).setattribute("style","font-weight:bold"); event.stoppropagation(); }); the problem h

algorithm - MATLAB error using symfun/subsindex -

i'm having trouble using dsolve symbolic functions. i'm receiving error stating: "error using symfun/subsindex (line 121) indexing values must positive integers, logicals or symbolic variables. error in vk3 (line 9) [f(n), g(n), h(n)] = dsolve(diff(f) == f2, diff(g) == g2,..." here's code stands. may seem stupid some, have relatively little experience matlab. if tell me i'm going wrong, i'd grateful. syms f(n) g(n) h(n) f2(n) g2(n) c = 1.004e-6; m = input('angular velocity = '); z = 0:1:20; r = input('radial distance = '); n = z*sqrt(m/c); [f(n), g(n), h(n)] = dsolve(diff(f) == f2, diff(g) == g2,... diff(f2) == f^2 - g^2 + f2*h,... diff(g2) == 2*f + g2*h,... diff(h) == -2*f,... f(0) == 0, h(0) == 0, g(0) == 1, f(20) == 0, g(20) == 0); u = m*r*f(n); v = m*r*g(n); w = sqrt(m/v)*h(n); subplot(3,1,1)

haskell - Why is repeat defined in Prelude as it is? -

this question has answer here: why recursive `let` make space effcient? 3 answers repeat is defined follows: repeat :: -> [a] repeat x = xs xs = x:xs is there reason following isn't used? repeat :: -> [a] repeat x = x : repeat x (obviously there many equivalent definitions many prelude functions, latter description feels more obvious. wonder if there's performance or style reason way is.) it performance , space complexity reasons. the first version of code uses explicit sharing; looks one-element circular linked list in memory (the xs in code list node has x value , tail points same list node). when evaluate more , more elements of list take same node repeatedly. in contrast, second version creates list grows in memory evaluated, because different invocations of repeat x recomputed (and not memoized). there yet unevaluated thunk

Delphi - read a Hex value in a text file and put it in a LongWord -

i need little project. have text file called script.txt, inside of it,i have: 0000fca2:fa2c 0000bc8d:f21c i need put '$0000fca2' in longword called "address". , put '$fa2c' in longword called "hexvalue". and, in second line have same. '$0000bc8d' in longword called "address2" , first, ihave put '$f21c' in "hexvalue2" longword. how can it? sorry, i'm begun delphi last week, have many doubts. googled question don't find answer it. , sorry wrong sentences, english isn't first language. thanks much! you create own lass reading , parsing file: uses system.generics.collections; type tdataline = class private fhexvalue: longword; faddress2: longword; public constructor create(const aline: string); property hexvalue: longword read fhexvalue; property address2: longword read faddress2; end; tdatafile = class(tobjectlist<tdataline>) public cons

escaping - How do I escape spaces in a path with Applescript? -

i've written script can link files , folders on server. problem string not escape spaces. can tell me how escape spaces '%20' ? tell application "finder" set sel (the posix path of (the selection alias)) set sel ((characters 10 thru -1 of sel) string) set sel "afp://myserver._afpovertcp._tcp.local/" & sel set clipboard sel end tell please thanks! you can use text item delimiters find , replace characters tell application "finder" set sel posix path of (the selection alias) set clipboard "afp://myserver._afpovertcp._tcp.local/" & (my findreplace(text 10 thru -1 of sel, " ", "%20")) on findreplace(t, tofind, toreplace) set {tid, text item delimiters} {text item delimiters, tofind} set t text items of t set text item delimiters toreplace set t t text set text item delimiters tid return t end findreplace

python - Array.extend(string) adds every character instead of just the string -

i trying extend element list in python, however, instead of extending string in index 'i' extends every character of string in index 'i'. for example have list called 'strings' string 'string1' , empty list called 'final_list'. i want extend first element of 'strings' 'final_list', final_list.extend(strings[0]) . instead of 'final_list' end length of 1, corresponding string inserted, list ends length of 7. if helps, code: con = connect() = 0 new_files = [] while < len(files): info_file = obter_info(con, files[i]) if info_file [5] == 0: #file not processed new_files.append(files[i]) += 1 does know how can make work? the extend method takes iterable argument, unpacks iterable , adds each element individually list upon called. in case, "extending" list string. string iterable. such, string "unpacked" , each character added separa

php - Will my old guzzle code run with a new version and what look for? -

i java programmer , new php. experiencing high cpu usage , long transaction times when acces services using guzzle. sending small message wil cost me on average half second. code below cost me 0.249 seconds // create rest client $client = new client(url, array( 'request.options' => array( 'auth' => array($lguser, $lgpassword, 'basic') ) )); $time_start = microtime(true); // login web service $request = $client->get('/partnerinformation.svc/login'); $request = $client->get('/partnerinformation.svc/login'); try { $response = $request->send(); $lgsid = $response->xml(); echo ("logged in successfully; sid: ".$lgsid); } catch (exception $e) { echo ("error while logging in: ".$e); } $time_end = microtime(true); $time_total = $time_end-$time_start; echo('login time: '.$time_total); are there things can speed things or find problem? i found out look

Can I modify Javascript code in Internet Explorer 11's debugger? -

Image
in ie11 can right click on webpage , call "inspect element" tool. allows me modify html/css dynamically , extremely useful. i can choose "edit html" , whatever want without having reload page. what want able same in ie 11's javascript debugger. want modify script in browser not have reload page entirely. page working on takes 20-40seconds load when run locally, meaning takes minute implement smallest changes in file.js. can done? if js code embed html should work without problems if it's stored other file can't edit in browser. recommend using firefox or chrome. both have got inbuilt , useful editors can edit html js , css .

installation GLCD ks0108 with raspberry pi -

can problem? i'm newbie project, , have searched time , can't find tutorial's. can me teach me how wiring glcd module ks0108 raspberry pi , python code? please see https://github.com/mezgrman/pylcd there instructions install modules, change wiring, , example code started with. once have had chance research, , try code, can come , ask question . https://stackoverflow.com/help/how-to-ask

osx - C++ duplicate symbols -

(mac) i've tried namespaces, include guards, pragma once, etc. basically, structure: cmakelists.txt add_executable(game game/main.cpp game/rtexture.cpp) game/main.cpp #include "cleanup.h" //... cleanup(foobar); game/rtexture.cpp #include "cleanup.h" //... cleanup(foobar); cleanup.h //various includes template<typename t, typename... args> void cleanup(t *t, args&&... args){ //cleanup first item in list cleanup(t); //recurse clean remaining arguments cleanup(std::forward<args>(args)...); } /* * these specializations serve free passed argument , provide * base cases recursive call above, eg. when args single item * 1 of specializations below called * cleanup(std::forward<args>(args)...), ending recursion * make safe pass nullptrs handle situations * don't want bother finding out values failed load (and null) * rather want clean , let cleanup sort out */ template<> void cleanup&l

elasticsearch - Passing Aggregations to NEST using QueryRaw -

we trying pass aggregations through nest in raw format: { "query": { "filtered": { "query": { "multi_match": { "query": "main", "type": "cross_fields", "fields": [ "field1", "field2^5", ], "operator": "and" } } } }, "aggregations": { "multiselectterms": { "terms": { "field": "field1.raw", "order": { "_count": "desc" } } } } } but when pass above json in nest not getting result. can please provide input how can pass aggregations in nest. var uri = new uri(configurationmanager.appsettings["elasticsearch_server"]);

linux - When to use upstart for Tomcat vs. Tomcat's Daemon Mode? -

Image
according tomcat docs , tomcat can set - on linux/unix - run daemon . however, behave daemon, special configuration required beyond defaults tomcat ships with. my understanding of true *nix daemon is background, non-interactive program, owned init process. typically, daemons scheduled background work , never driven input actual user. here root of question: seems tomcat can given daemon-like behavior it's own daemon mode (first link above) or via number of built-in linux tools ( upstart , init.d , systemd , etc.). means have 4 possible scenarios here: on 1 hand, may choose use tomcat's daemon mode or not. may choose use built-in linux tool or not. what i'm looking this: what use cases necessitate each of 4 scenarios depicted above? is: when use tomcat's daemon mode, and use, say, upstart ? when not use tomcat's daemon mode, use upstart ? when use tomcat's daemon mode, not use upstart ? when use neither? obviously, in questions, can re

pdo - errors in PHP Paypal pay request -

i have written library program user can search books. onto part user can select item it's id , own username. sets a payment on paypal user approve. i've made start i'm quite lost. book id , fill use details stored in database - price , title set payment. the first issue i'm having following error: undefined index: book_id i error price, user , title. here code payment: try { $dbh = new pdo('mysql:host=' . db_host . ';dbname=' . db_username, db_username, db_password); } catch (pdoexception $e) { print "error!: " . $e->getmessage() . "<br/>"; die(); } $book =$_post["book_id"]; $user =$_post["user"]; $price =$_get["price"]; $title =$_get["title"]; $sth = $dbh->prepare("select title, price books2 b_id=$book"); $sth->execute(); $payer = new payer(); $payer->setpaymentmethod("paypal"); $item1 = new item(); $item1-&g

asp.net - How to add new row to a databound gridview? -

i'm trying add new blank row gridview whenever user clicks add row button. ideally, whichever row click button, new row inserted below row. i've read through lot of previous questions still cannot gridview display new blank row. page code: <table> ... ... <td colspan="3" align="left" style="border: thin solid #000000; vertical-align: top; background-color: #4b6c9e"> <asp:updatepanel id="updatepanel1" runat="server" > <contenttemplate> <asp:gridview id="grdhours" runat="server" autogeneratecolumns="false" width="100%" cellpadding="4" forecolor="#333333" gridlines="none" > <alternatingrowstyle backcolor="white" verticalalign="top" height="20px"/> <columns> <asp:templatefield showheader="false

python - Sum Parts of Multiple Lists -

this question has answer here: element-wise addition of 2 lists? 12 answers i'm sure there way accomplish want without looping on lists , creating new objects. here have a = [1, 2, 3, 4] b = [2, 3, 4, 5] what looking take each set of lists , sum each placeholder output is [3, 5, 7, 9] thoughts? you should use zip function , list comprehension a = [1, 2, 3, 4] b = [2, 3, 4, 5] [sum(t) t in zip(a,b)]

liferay - How to set width of Primefaces-Carousel to full page width? -

i have created carousel in primefaces/liferay. has fixed width , height. how can set full page/ full div width of portlet? you can add custom styles primefaces-carousel following ways: itemstyle attribute inline styling of <p:carousel> tag: itemstyle="width:100%;" itemstyleclass attribute style class of <p:carousel> tag: itemstyleclass="fullwidthclass" or add width inside container either through styleclass or style attribute following: <ice:panelgrid style="width:100%"></ice:panelgrid> <ice:panelgrid styleclass="fullwidthclass"></ice:panelgrid> css: fullwidthclass { width: 100%; /* other properties */ }

osx - OS X command line application cannot find directory while called from Java -

if run in terminal works fine: lsof -f n +d /some/directory but when run same thing java not: process lsof = new processbuilder("lsof", "-f", "n", "+d", "'/some/directory'").start(); lsof.waitfor(); if (lsof.exitvalue() != 0) { bufferedreader reader = null; try { reader = new bufferedreader(new inputstreamreader(lsof.geterrorstream())); string line = null; stringbuffer sb = new stringbuffer(); while ((line = reader.readline()) != null) { sb.append(line); sb.append("\n"); } log.warning("stdout:\n" + sb.tostring()); } {

html - Preventing main div from scrolling underneath Header -

i have problem "main" div holds content of webpage scrolls under header , nav bar. i've been looking around solutions , people position: fixed position: absolute . however, when try these div still scrolls under header , nav bar. i've tried set top: 980px; account pixel size of these 2 elements , still scroll. @import url(http://fonts.googleapis.com/css?family=pacifico); body { background-image: url("paws1.jpg"); font-family: "helveticaneue-light", "helvetica neue light", "helvetica neue", helvetica, arial, "lucida grande", sans-serif; font-weight: 300; } /* header elements */ img { display: block; } header { width: 950px; margin: 0 auto; height: 250px; position: fixed; background-color: rgba(144, 214, 32, 1); min-width: 950px; z-index: 1; top: 0px; } header div { display: inline-block; } #nav { width: 950px; content: ""; margin: 0 au

java - Send multiple files using socket -

i'm trying send multiple files client server using socket when click upload button adds 1 file , second click adds second. code: client void sendfile (string st, string na) throws ioexception{ socket sock = new socket("127.0.0.1", 1112); //objectoutputstream out = new objectoutputstream(sock.getoutputstream()); //outstream.writeobject("test message #"); //outstream.flush(); //fileinputstream fi = null; try { // todo add handling code here: fileinputstream fi = new fileinputstream(st); byte [] buffer = new byte[fi.available()]; fi.read(buffer); objectoutputstream out = new objectoutputstream(sock.getoutputstream()); out.writeobject(buffer); out.flush(); out.close(); //outstream.writeobject(buffer

assembly - Difference Between Page Table and Page Directory -

i have been hearing term address space in microprocessors , microcontrollers paradigm. understand address used refer particular block of memory in physical memory(primary). if i'm right , address space super set of such addresses. right? by using virtual memory/paging extending address space using secondary storage. in paradigm page table, page table entry , page directory? understand first p.memory segmented , logically , these segments divided pages. page table? table containing pages? , page directory super table of page tables? in x86 architecture, page directories , page tables provide mapping between virtual addresses (memory addresses used applications) , physical addresses (actual locations in physical memory hardware). a page contiguous chunk of memory. x86 (32-bit) supports 3 sizes of pages: 4mb, 2mb, , 4kb, latter being commonly used in mainstream operating systems. page table array of 1024 * 32-bit entries (conveniently fitting single 4kb page)

Histogram - Wine Data Set - R -

i have solved problem. making small error did not see still new r. thank help! i having lot of trouble trying make histogram wine data set available uci machine learning repository. homework assignment don't want/can't have exact answer, rather pointed in right direction. have been running around in circles days. #csv <- comma separated values wine <- read.csv("c:\\users\\ashley~1\\appdata\\local\\temp\\rtmpgqbfyn\\data167c33fa34b4", header=false) wine <- gsub(",", "", wine) # remove comma hist(wine) i try reading data directly repo instead of saving file first... library("httr") <- get("https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data") df <- read.csv(textconnection(content(a)), header=f) histograms seems work fine here...

Header not getting written in csv at the time of export from python -

i using python 3.4. exporting results python csv file. headers not getting written. given below piece of code using with open('c:/twitter_crawl/scoring_tweet.csv', 'r') fp: with open('scored_tweets.csv', 'w',newline='') op: headers=['processed_tweet','sentiment'] = csv.dictwriter(op,delimiter=',',fieldnames=headers) line in fp.readlines(): sentiment = nbclassifier.classify(extract_features(getfeaturevector(line))) a.writerow({'processed_tweet':line,'sentiment':sentiment}) the file created data populated no headers. can please me out? thanks in advance!! to write header, must call csv.dictwriter.writeheader method: writerow write rows...

Android Change a variable in service from other app -

the title says all, need change variable of service activity in other app , finalize service or not, possible? i found message object , not quite understand the simplest solution implement broadcastreceiver . service listens broadcast , other app sends broadcast. example reciever: public class myreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { // bundle intent , use set variable in service } } example broadcaster ( courtesy of vogella ): intent intent = new intent(); intent.setaction("de.vogella.android.mybroadcast"); sendbroadcast(intent);

batch file - Run a command promt and run a command -

i need write command calling other command prompt of oracle , running command on it. currently, running using below command d:\oracle\setenv.bat /k buildapp but runs setenv.bat , quits , doesn't run buildapp . buildapp run on command prompt opened setenv.bat . can please on this? try cmd /c d:\oracle\setenv.bat /k buildapp .

php - architecture MVC script -

i write social network mvc architecture work localhost (wampserver) correctly when upload on real host error in http://example.com/ warning: require_once(views/index/index.php): failed open stream: no such file or directory in /home3/farazenc/public_html/fb/views/index.php on line 14 fatal error: require_once(): failed opening required 'views/index/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home3/farazenc/public_html/fb/views/index.php on line 14 and method not work example when go http://example.com/index/register must show register form show 404 my main file: .htaccess rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^(.+)$ index.php?url=$1 [qsa,l] index.php <?php session_start(); require_once './config.php'; require_once './lib/database.php'; require_once ('./lib/function.php'); $c

python - Raise Exception when WHERE doesn't exist during UPDATE query -

i'm using mysqldb / python api project , ran problem: def activate_acct(act_link): # connect db = mysqldb.connect(host=db_host, user=db_user, passwd=db_pass, db=db_name) # create database cursor cursor = db.cursor() try: sql = """update users set activated = %s activate_code = %s""" cursor.execute(sql, (1, act_link)) db.commit() return "activated" except exception e: return e the query works, in when activate_code found, activated changed, db updated want, , see success message. problem if activate_code doesn't exist and/or invalid, still success message. how can have query raise exception if activate_code isn't found where? an update statement changes nothing still considered successful. told database make change wherever found value; value found nowhere, change made nowhere. did asked. if want check make sure change made, c

sql server - Stuck with sql joins -

i newbie sql. have these tables: table individual: individualid individualname ind1 mark ind2 paul ind3 spencer ind4 mike ind5 hilary table agent: agentid indid(foreignkey) agent1 ind1 agent1 ind2 agent2 ind1 agent3 ind4 transaction table (transaction can made via agent or individual himself): tranid indid(foreignkey/never null) agentid(foreignkey) tranamount tran1 ind1 agent1 $100 tran2 ind1 null $500 tran3 ind3 null $200 tran4 ind4 agent3 $50 tran5 ind4 null $30 result should like: (if transaction associated agent, display in same line else display on separate line) individualid individualname agentid tranid tranamount ind1 mark agent1 tran1

java - MuleESB AnyPointStudio JPA implementation -

i'm using ce mule server 3.5.0, , anypoint studio ide. i can't find way implement jpa entitymanager; there aren't tutorials or explanations on how that, how put ds in muleserver or use dbconnector ds...just don't know... i can guess persistence.xml goes in src/main/resource of project, not sure of too. can point me in right direction? thanks 4 coop! have seen following example?: http://java.dzone.com/articles/getting-started-jpa-and-mule

How to understand the list comprehensions in making list in python? -

i have list of tuples, converted list has elements of list type, since each element list, can insert natural number @ head. let's put: l = [('c++', 'compiled'), ('python', 'interpreted')] lx = [] z in xrange(len(l)): y = [x x in l[z]] y.insert(0, z) lx.append(y) print lx [[0, 'c++', 'compiled'], [1, 'python', 'interpreted']] look, job done, works in way. except of followings neither: l = [('c++', 'compiled'), ('python', 'interpreted')] lx = [] z in xrange(len(l)): y = [x x in l[z]] lx.append(y.insert(0, z)) print lx [none, none] nor: l = [('c++', 'compiled'), ('python', 'interpreted')] lx = [] z in xrange(len(l)): y = [x x in l[z]].insert(0, z) lx.append(y) print lx [none, none] not mention: l = [('c++', '

angularjs - Angular: append html in dom element -

i need write directive append html in div here want append html server usinh $http post request <div id="invoice_template_preview" ng-bind-html-unsafe="invoice_html_template" class="span6" style="background: rgba(242, 230, 205, 0.95);margin: -100px 0 0 0;border: 1px solid #ddd; height: auto;padding: 18px;position: relative;width: 50% !important;"> </div> this angular function html db $scope.getinvoicetemplate = function() { $scope.invoicetemplate = []; var request = $http({ method: "post", url: "/c_make_invoice/", data: { action: 'getinvoicetemplate', id:$scope.our_company_id }, headers: { 'content-type': 'application/x-www-form-urlencoded' } }); request.success(function (data) { $scope.invoicetemplate = data.result; $scope.invoice_html_template = $scope.invoicetempla

active directory - Unable to Delete Computer account by DSRM cmd -

i able disable cant delete computer account using dsquery computer -name %%i | dsmod computer -disabled | dsrm** complete command below @echo off cls echo deleting computer acocunt form ad... timeout 1 > nul pause /f %%i in (c:\commback\script\delete_cn.txt) ( dsquery computer -name %%i | dsmod computer -disabled | dsrm )