Posts

Showing posts from January, 2013

php - Get data except for data in a column -

so have following code: require_once('db.php'); $getusers = mysqli_query($db, 'select * users'); $rows = []; while ($r = mysqli_fetch_assoc($getusers)) { $rows[] = $r; $getskills = mysqli_query($db, "select * skills id = '" . $r['id'] . "'"); while($r = mysqli_fetch_assoc($getskills)) { $rows['skills'] = $r; } } print(json_encode($rows)); which outputs: [{"id":"1","name":"user1","skills":{"woodcutting":"6","mining":"10"}},{"id":"2","name":user2"}] there 2 problems: i'd of data in table skills except id, or at-least cut off before encoding json. for reason can't "skills" shown after first user. user2 should have skills object. what doing wrong? to columns except id table skills , can either list columns want select, this: mysqli

mysql - SQL Querying: How to Find the Maxima of Certain Columns within Different Sets of Similar Records? -

how find secret ingredients used in pizzas have won prize? i’m missing sql condition in comment below: select r.name, p.secret_ingredient restaurants r join restaurant_has_pizzas rhp on rhp.restaurant_id = r.id join pizzas p on p.id = rhp.pizza_id join awarded_prizes on a.id = r.latest_prize_id r.owner = 'me!' , p.created_at < a.won_at -- , p young/new possible, i.e., p.created_at close -- a.won_at possible; i’m interested in winning pizzas -- have been made right before taster awarded prize! ; the query far returns kinds of ingredients used in restaurants have won prize. however, i’m interested in those secret ingredients used in winning pizzas. note chefs have created newer pizzas since have won last prizes. here’s ddl: create table pizzas (`id` int not null auto_increment, `created_at` datetime not null, `secret_ingredient` varchar(42) not null, primary key (`id`)) ; insert pizzas (`created_at`, `secret_ingredient`) value

linux - PHP forked process not exit completely and become zombie -

this question has answer here: php forking issue 2 answers this simplified program. the test.php daemon program, running there. forks process work on task. once finishing work, forked process exits. when forked process exits, becomes zombie. how make forked process exit without becoming zombie? #!/usr/bin/php <?php while (1) { sleep(1); $pid = pcntl_fork(); if (!$pid) { $mypid = getmypid(); sleep(5); print "pid=$mypid finish work \n"; exit(); } sleep(1); } // while ?> ./test.php ... daemon running ... $ ps -ef | grep mqp ubuntu 10084 10073 0 12:21 pts/0 00:00:00 /usr/bin/php ./test.php ubuntu 10085 10073 0 12:21 pts/0 00:00:00 /usr/bin/php ./test.php ubuntu 10074 10073 0 12:21 pts/0 00:00:00 [test.php] <defunct> ubuntu 10075 10073 0 12:21 pts/0 00:00:00 [test.php] <defunct>

javascript - How does ServiceNameQuery work in AngularJS -

for example, there following piece of code: $scope.posts = post.query({ user_id: $stateparams.user_id }) how construction work? when js execute line posts may empty, after time server side return posts , view render lot of posts. how 'query' function may return value in future? don't understand it, because ajax call asynchronous, , don't send value in function. please, describe moment. thanks. i know promises , $q, don't understand how works here. internally executes asynchrnous operation , returns reference empty array. when asynchronous operation has finished populate array elements. $scope.posts reference same array, containing elements. simple example implementation: app.factory('post', function ($timeout) { var query = function (selector) { var result = []; // asynchronous operation $timeout(function () { (var = 0; < 5; i++) { result.push({ id: }); } }, 3000); return result;

c# - Custom Authorize Attribute and Entity Framework -

i implementing action/activity based authorization in asp.net application. trying make reusable library can use other projects. using entity framework data access. i able implement functionality not sure how configure entity framework connection string authorize attribute. custom authorize attribute: public class authorizeaction: authorizeattribute { private string _actions; private string[] _actionssplit = new string[0]; public string actions { { return _actions ?? string.empty; } set { _actions = value; _actionssplit = value.split(','); } } protected override bool authorizecore(system.web.httpcontextbase httpcontext) { string userid = string.empty; if (httpcontext == null) { throw new argumentnullexception("httpcontext"); } iprincipal user = httpcontext.user; if(!user.identity.isauthenticated) {

php - preg_match Regex Matching Full String -

i have simple regex, it's matching more want... basically, i'm trying match operators (eg. > < != = ) followed string. regex: /^(<=|>=|<>|!=|=|<|>)(.*)/ example subject: >42 what i'm getting: array (size=3) 0 => string '>42' (length=3) 1 => string '>' (length=1) 2 => string '42' (length=2) what i'm trying get: array (size=2) 0 => string '>' (length=1) 1 => string '42' (length=2) what don't understand regex works on regex101 edit: clarify, how can rid of full string match? your answer correct. group(0) whole match . group(1) if first group , group(2) second group.

c++ - Fill function in basic graphics app in Qt -

i have been creating basic graphics program(like ms paint) simple gui. have 2 classes 1 mainwindow holds buttons, sliders etc , second class custom widget called drawingarea on user able draw. basicly i've implemented of functions, unfortunetly stucked @ filling function, should work 1 in ms paint. decided use called floodfill algorithm , after few hours of fighting(i beginner in qt) have managed make work. not @ all. problem able fill black-colored regions(shapes, lines, points etc) color choose. when comes filling different colors, puts 1 pixel in chosen color. in funcion fill(...) below passing 2 arguments - point(mouseclicked) , color of point. here: void drawingarea::fill(const qpoint &point, qcolor act) { qpainter painter(&image); qpen mypen(actualcolor); mypen.setwidth(1); painter.setpen(mypen); qqueue<qpoint> pixels; pixels.enqueue(point); while(pixels.isempty() == 0) { qpoint newpoint = pixels.dequeue(); qcolor actual; actual.fromrgb(imag

javascript - How can I add a custom attribute to an HTMLElement, that will default to an empty object on each new instance of the element? -

if add new property prototype of htmlelement , , have default value ' {} ' (an empty object): object.defineproperty(htmlelement.prototype, 'customobject', { configurable: true, enumerable: true, writeable: true, value: {} }); now create new div (which htmlelement ): var e = document.createelement('div'); i assign property customobject of e : e.customobject.prop = "bla"; if alert it, see desired value: alert(e.customobject.prop); // displays 'bla'. now create new, different div element: var d = document.createelement('div'); this d should have empty customobject property, right? however, if alert it: alert (d.customobject.prop); i unexpected result: bla how come? when create new element shouldn't have "blank" instance of htmlelement.prototype? ( jsfiddle: http://jsfiddle.net/5pgr38mb/ ) edit: looking solution will work deep cloning (clonenode(true)). meaning - if custom object

Using wwwhisper for a Django app in Heroku -

it possible use wwwhisper add-on django app? in case, can find guide how configure it? i've installed add-on, don't know how make work. thanks. wwwhisper author here. add-on works ruby , node.js applications on heroku.

c# - IIS7 adds gibberish to URL, causes 404 for CSS files -

i have c# web application runs fine when hosted visualstudio. when host on iis, link css stylesheet returns 404 error. basically: http://hostname/sitename/default.aspx becomes http://hostname/sitename/(s(ubd3fhzfs04ebb1qzfsjlsse))/default.aspx i dont know might've changed, started happening after publish couple of weeks ago. i have tried deleting site folder , re-publishing. i have 2 other applicatins hosted published via vs, , urls normal i.e. http://hostname/sitename/default.aspx from can tell, web.configs , iis setups same sites. that url contains session cookie id, caused cookieless session (either cookies disabled , automatic detection kicks in, or explicitly set cookieless sessions, or caused device-specific asp.net configuration). can fixed changing session settings. however, fix static file references relative instead of absolute, wouldn't cause 404 errors in different setups. cookieless url's handled transparently asp.net, don't

javascript - check for undefined not working -

i started programming javascript no long ago. still confused way handles arrays. problem have array in there content undefined. want check undefined values , escape them. how do it. following code not working , have not found way solve problem. if(myarray[0]!=='undefined') if(myarray[0])!='undefined') // have tried if(myarray[0]).search('undefined')==(-1)) // , however none of these options working. see when debugging value in array 'undefined' condition never met. once again aim when not undefined. please how it. found similar question test if not undefined in javascript not work you comparing undefined 'undefined' , string different. need compare this: myarray=[undefined]; if(myarray[0]!==undefined){ console.log(4) }

java - Jetty server configuration -

i use jetty 9 , have problems configuration. simple rests works fine. problem begun when tried add new headers requests , error handler. way able handle headers adding code every response: return response.ok(murals) .header("access-control-allow-origin", "*") .header("access-control-allow-methods", "get, post, delete, put") .build(); server configuration: server server = new server(9998); servletcontexthandler servletcontexthandler = new servletcontexthandler(server, "/", servletcontexthandler.sessions); servletcontexthandler.addfilter(guicefilter.class, "/*", enumset.allof(dispatchertype.class)); servletcontexthandler.addservlet(defaultservlet.class, "/"); resourceconfig rc = new resourceconfig() .register(filterheaders.class) .register(exceptionnotfound.class) .registe

Execute ScriptCS from c# application -

background i'm creating c# application runs status checks (think nagios style checks). what ideally want c# application @ specific directory, , compile/execute scriptcs scripts within it, , act on results (send email alerts failing status checks example). i expect script return integer or (for example) , integer indicate weather status check succeeded or failed. values returned c# application. 0 - success 1 - warning 2 - error when first tasked thought job mef, vastly more convenient create these 'status checks' without having create project or compile anything, plopping scriptcs script within folder seems way more attractive. so questions are is there documentation/samples on using c# app , scriptcs (google didn't net me much)? is use case scriptcs or never intended used this? would have easier time creating custom solution using roslyn or dynamic compilation/execution? (i have little experience scriptsc) i found easy examples on how th

javascript - Trouble opening and closing a div with jQuery -

.box-one { border: 0.1em solid #ccc; } .dropdown-info { display: none; } <div class="box-one"> <div class="header"> <h3 class="text-center">sample header</h3> </div> <div class="dropdown-info"> <p class="text-center">sample text</p> </div> </div> i'm trying open , close div if div clicked on , tried both .toggle() , .click() won't work. else's opinion on it. show how tried accomplishing using both methods $(document).ready(function() { var descriptionopen = false; if (descriptionopen === false) { $('.header').click(function() { $('.dropdown-info').show(); descriptionopen === true; }); }; else if (descriptionopen === true) { $('.header').click(function() { $('.dropdown-info').hide(); descr

big o - Time Complexity Python Script -

i writing small script guesses numeric passwords (including ones leading zeros). script works fine having trouble understanding worst case time complexity algorithm. insight on complexity of implementation great, thanks. def bruteforce(ciphertext): plen in itertools.count(): password in itertools.product("0123456789", repeat=plen): if hashlib.sha256("".join(password)).hexdigest() == ciphertext: return "".join(password) first, it's possible you're going find hash collision before find right password. and, long-enough input string, guaranteed . so, really, algorithm constant time: complete in 2^256 steps no matter input is. but isn't helpful when you're asking how scales more reasonable n , let's assume had upper limit low enough hash collisions weren't relevant. now, if password length n, outer loop run n times.* * i'm assuming here password will purely numeric. other

R: all.equal() for multiple objects? -

what best way compare more 2 objects all.equal() ? here's 1 way: foo <- c(1:10) bar <- letters[1:10] baz <- c(1:10) # doesn't work because all.equal() returns character vector when objects not equal all(sapply(list(bar, baz), all.equal, foo)) # works mode(sapply(list(bar, baz), all.equal, foo)) == "logical" #false bar <- c(1:10) mode(sapply(list(bar, baz), all.equal, foo)) == "logical" #true update: @brodieg pointed out one-liner above tells whether objects equal or not, whereas all.equal() tells isn't equal them if aren't equal. here option: objs <- mget(c("foo", "bar", "faz")) outer(objs, objs, vectorize(all.equal)) it's better yours because detect when bar , faz same, when foo isn't. said, lot of unnecessary comparisons , slow. example, if change foo letters[1:10] get: foo bar faz foo true character,2 character,2 ba

drupal - Virtual host in apache on Mint VM doesn't work -

i have apache running on mint vm on windows 8 host can use vm drupal development. created virtualhost entry in /etc/apache2/apache2.conf can use www.mysite.dev development url, , set hosts files on guest host machines. target platform deployment acquia, in case that's relevant. the problem i'm having that, when use browser in guest go http://www.mysite.dev/ , site, when access http://www.mysite.dev/any-non-root-path , 404. also, when use browser on host go http://www.mysite.dev , instead apache default home page. in /etc/apache2/apache2.conf on guest, have: <virtualhost www.mysite.dev:80> documentroot /var/www/html/mysite/docroot/ servername www.mysite.dev </virtualhost> in /etc/hosts on guest, have: 127.0.0.1 localhost 127.0.1.1 vm-name 127.0.0.1 www.my-site.dev # following lines desirable ipv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 i

c# - How to find all partitions of a set -

i have set of distinct values. looking way generate partitions of set, i.e. possible ways of dividing set subsets. for instance, set {1, 2, 3} has following partitions: { {1}, {2}, {3} }, { {1, 2}, {3} }, { {1, 3}, {2} }, { {1}, {2, 3} }, { {1, 2, 3} }. as these sets in mathematical sense, order irrelevant. instance, {1, 2}, {3} same {3}, {2, 1} , should not separate result. a thorough definition of set partitions can found on wikipedia . i've found straightforward recursive solution. first, let's solve simpler problem: how find partitions consisting of 2 parts. n-element set, can count int 0 (2^n)-1. creates every n-bit pattern, each bit corresponding 1 input element. if bit 0, place element in first part; if 1, element placed in second part. leaves 1 problem: each partition, we'll duplicate result 2 parts swapped. remedy this, we'll place first element first part. distribute remaining n-1 elements counting 0 (2^(n-1))-1. now can partition s

how can i create a new String in a get Method?(Java) -

i have code down below. want if there no other person in row getmother method create new string or person first name "eva" , return this. code doesn't work. "null". how can this? pls help public person getmother() { if (mother == null) { person p = new person("eva"); } return mother; } you should initialize mother , not p : public person getmother() { if (mother == null) { mother = new person("eva"); } return mother; }

mongodb - Select nested fields in mongo db -

i have collection in mongodb fields nested under language root: { en: { title: "eng title", content: "eng content", }, it: { title: "it title", content: "it content" } //common attributes languages images: { mainimage: "dataurl", thumbimage: "dataurl" } } i have variable called 'currentlang'; need find document title selecting "currentlang" object , common fields (images in example); "currentlang" object, have output document not nested; example, having currentlang = "en" desired output: { title: "eng title", content: "eng content", images: { mainimage: "dataurl", thumbimage: "dataurl" } } is possible? you need aggregate below: construct find object match records containing( $exists ) language. construct projection

c++ - Splitting char array -

i have char **names array stores names file. this .txt file mike, sam, stuart andre, williams, phillips patels, khan, smith basically, want split , store names before , character. example, mike, sam, stuart become... newname[0] = mike newname[1] = sam newname[2] = stuart i have this... for (int i=0; i<3; i++) { (int j=60, j>0; j--) { if(names[i][j] == ',') { cout << j << endl; //this prints out position. how can store position , something? } } } i appreciate if me code, in right direction. don't want use vectors classes i have attempted store marks of these students, want add double *marks[2] array. this .txt file... 69.9, 56.5 29.8, 20.0 35.6, 45.0 this code... char **values; char * pch; pch = strtok (values[i], " ,"); while (pch != null) { sscanf(pch, "%f, %f", &marks[i][0], &marks[i][1]); pch = strtok (null, " ,"); } i getting random values su

android - How to alternate between fragment containers easily? -

i've got problem i'm having problems solving. app has 2 types of fragments. when app starts, fragment main menu added framelayout use fragment container. fragment takes entire screen. then, when choose 1 of items in menu, corresponding fragment should loaded container, replacing menu. however, fragment must take 1/4 of screen left, , space outside used other fragment. i thinking making 3 framelayouts , 1 left side, 1 right , 1 entire screen, going have problems fragment transactions, since have keep tabs on fragments , remove them hand. basically need way change whether fragments loaded container takes full screen, or container takes part of screen. tons of trail , error , code, bet there easy way in android missed. instead of trying dynamically load these fragments various containers, suggest having 2 different activities . it sounds main menu fragment ever appear on own in full screen. so, make full activity (let's call mainmenuactivity ). the seco

java - trouble using printwriter from another class -

my main problem nullpointerexception when use chatpanel.pw.println(chatpanel.name + " has disconnected chat.") while printwriter in chatpanel class , i'm trying use printwriter send message through socket. if me understand , maybe give me solution problem. did remove lot of code but, should compile. import java.io.*; import java.awt.*; import java.net.*; import javax.swing.*; import java.awt.event.*; import javax.swing.jcomponent; public class chatframe1 extends jframe{ public chatframe1(){ setlayout(new gridbaglayout()); setsize(1000,600); settitle("chat"); setresizable(true); addwindowlistener(new windowadapter(){ public void windowclosing(windowevent we){ //the problem here. chatpanel.pw.println(chatpanel.name + " has disconnected chat."); system.out.println(chatpanel.name); system.exit(0); } }); chatpanel sp = new chatpanel();

C++: What does the class destructor do? -

c++: class destructor do? suppose have object "myobject", , has several members follows: int a; float b; yourclass yourobject; void hismethod(); from read, memory allocated "myobject" order. once destructor called, happened? after destructor called, before object destroyed, read, can still access (a) object "myobject". (b) member yourobject (c) member hismethod() can still access members? undefined behavior? many c++ books not talk more details on it. can find more details on it? because details can me understand many c++ rules "not manually call destructor unless after placement new". [update 1] raise question because saw post: what empty destructor do? poster gives example below: #include <iostream> #include <set> class { public: std::set <int> myset; }; int main() { object; object.myset.insert(55); object.~a(); object.myset.insert(20); std::cout << object.myset.size(); } the poster get: &quo

bash - replace varying number of spaces in file with single space -

i have list of files have columns separated varying number of spaces. how can sed or similar each column separated single space or tab? i tried: sed 's/ \+ /\t/g' file > tmp sed "s/\ /\t/g" tmp > file but r complained line 526 did not have 11 elements you use tr tr -s < filename or sed sed -e 's/ \+/ /g' filename inline sed sed -i.bak -e 's/ \+/ /g' filename

What do the icons mean in the monodevelop solution? -

Image
why files have pencil icon, have plus, have none? mean? figured out. it's git status of files. modified, added, etc..

Julia graphs, dijkstra_shortest_paths -

i have expandable graph, being able add vertices , edges, , run dijkstra_shortest_paths algo. not able find right way define graph dijkstra_shortest_paths work. below attempt. using graphs g1= graph(exvertex[], exedge{exvertex}[], is_directed=false) dist_key = "dist" v1 = add_vertex!(g1, "a") v2 = add_vertex!(g1, "b") v3 = add_vertex!(g1, "c") e12 = add_edge!(g1, v1, v2) e12.attributes[dist_key]=1.0 e13 = add_edge!(g1, v1, v3) e13.attributes[dist_key]=1.0 e23 = add_edge!(g1, v2, v3) e23.attributes[dist_key]=1.0 epi = attributeedgepropertyinspector{float64}(dist_key) dijkstra_shortest_paths(g1, epi, ["a"]) error message: dijkstra_shortest_paths has no method matching dijkstra_shortest_paths(::genericgraph{exvertex,exedge{exvertex},array{exvertex,1},array{exedge{exvertex},1},array{array{exedge{exvertex},1},1}}, ::attributeedgepropertyinspector{float64}, ::array{asciistring,1}) i think problem ["a"] - have

ubuntu - MongoDB service doesn't start. errno:13 Permission denied -

i have installed mongodb on ubuntu server indicated in docs http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/ . then, have modified configuration file /etc/mongod.conf for, later, run mongod service. mongodb runs correctly if execute: sudo mongod -f /etc/mongod.conf but mongodb stops if execute: sudo service mongod start in config file /etc/mongod.conf changed this: dbpath=/data/db logpath=/root/logs/mongod.log port=20000 with configuration, log file not created too. if don't modify previous values indicated, service starts correctly. default values are: dbpath=/var/lib/mongodb logpath=/var/log/mongodb/mongod.log port = 27017 because log file not created custom configuration, have changed dbpath see error: [initandlisten] exception in initandlisten: 10309 unable create/open lock file: /data/db/mongod.lock errno:13 permission denied mongod instance running? i tried run following commands without success: sudo chown -r `id -u` /data/db

rails render an action with nested route -

i have nested resource so: resources :contacts resource :leads end when render edit view, url looks so: http://localhost:3000/contacts/1/leads/1 when submit form , goes leads controller update action: def update if @lead.update_attributes(lead_params) redirect_to contact_lead_path(@lead.contact, @lead) else render :edit end end when else triggered, renders page so: http://localhost:3000/leads/1 when should be: http://localhost:3000/contacts/1/leads/1/edit why doesn't "render :edit" account full nested url? how can resolve this? look @ way form set in view. should following. leadscontroller#edit method need load both @contact , @lead . <%= form_for [@contact, @lead] |f| %> ... <% end %> the fact you're getting non-nested-resource url form suggests you're not using pattern, , should. also, assume typo, in question, you're declaring nested route as resource :leads instead o

python - PyUnicodeUCS2_* error while importing VTK -

i've run strange problem. i built vtk python wrappings on cent os 6.5. on importing vtk gives me pyunicodeucs2_* error. checked python used build unicode setting sys.maxunicode. ucs4. searched error , found error occurs when vtk built using ucs2 python. but, not case in case. reason error? the python i'm using picked other machine . if run maxunicode on original previous machine shows usc2. same python (i copied whole folder python2.6) on other machine i'm building vtk, shows maxunicode ucs4. think has problem. please help. this error caused using extension built ucs2-based python interpreter ucs4-based interpreter (or vice-versus). if built using same python interpreter confusing in build environment.

Python urllib2 does not respect timeout -

the following 2 lines of code hangs forever: import urllib2 urllib2.urlopen('https://www.5giay.vn/', timeout=5) this python2.7, , have no http_proxy or other env variables set. other website works fine. can wget site without issue. issue? if run import urllib2 url = 'https://www.5giay.vn/' urllib2.urlopen(url, timeout=1.0) wait few seconds, , use c-c interrupt program, you'll see file "/usr/lib/python2.7/ssl.py", line 260, in read return self._sslobj.read(len) keyboardinterrupt this shows program hanging on self._sslobj.read(len) . ssl timeouts raise socket.timeout . you can control delay before socket.timeout raised calling socket.setdefaulttimeout(1.0) . for example, import urllib2 import socket socket.setdefaulttimeout(1.0) url = 'https://www.5giay.vn/' try: urllib2.urlopen(url, timeout=1.0) except ioerror err: print('timeout') % time script.py timeout real 0m3.629s user 0m0.020

select - SQL Inner Join customers with orders -

if have 2 tables (one of customers, information including address, name, emails etc) , of orders (with order number, shipping date, customer name ordered item), how show email of customers have less 3 orders? i know have use inner join , alias's, i'm not sure how proceed. thanks! what have far: select customer.email customer cust inner join (select customer_id, sum(line_qty) total orders o on cust.customer_id = o.customer_id total = (select total < 3 (select customer_id, sum(line_qty) total orders o on cust.customer_id = o.customer_id ) sub); i have created full example sql. run query create database, tables, , stored procedure "get customer orders". there sample data in 2 table of "customers" , table "orders" relation "1 customer many orders" there foreign key customer inside table orders, id

javascript - force download base64 image -

to start js isn’t 1 of strengths. i’ve been trying past couple of days edit js function make force download base64 image. function does, when download button clicked, open new window image on it. user has right click , save picture. i’m trying force download image instead of right click , ‘save as’. the dataurl produce base4 png string (data:image/jpeg;base64,/9j/4aaqskzjrgabaqaaaqabaad/2wbdaaebaqebaqebaq………) i tried using suggested in thread didn't work. all suggestions welcomed. thanks. savepaint: function() { var self = this; dataurl = self.context.canvas.todataurl(); var cntnt = $("<p class='dialogheader'>please right click , select 'save image as' option. click here return</p> <img id='printimage' src=" + dataurl + ">"); self.newsavedimage.html(cntnt); self.showpopup(self.newsavedimage, self.canvaswidth, self.canvasheight) }

Excel VBA: Move Outlook email in public folder without using GetNamespace("MAPI") -

i'm trying following: have list of email in subfolder of inbox (named "a_classer") need run code take emails , place them in folder. destination folder vary based upon subject of message. need in excel because destination file vary based upon information in excel workbook. so problem i'm using windows 32 bit system. i've read seems doesn't support getnamespace("mapi") method. because when run "error 438" @ getnamespace("mapi") line if destination file reside in inbox, need move emails public folder. so here code far. if me pass error 438 helpfull. sub move_to_public_folder() dim msg outlook.mailitem dim olfolder outlook.folder 'public folder want email moved dim sourcefolder outlook.folder 'current folder of emails moved dim olapp object dim mynamespace outlook.namespace dim myrecipient outlook.recipient set olapp = createobject("outlook.application")

php - How to return just JSON response from Laravel 4 REST API? -

i have laravel restful api setup needs return data in json format app on 1 of subdomains ( , not within laravel app ). in rest returning like: return \response::json(array( "status" => "success", "type" => "client", "message" => "nothing see here!" )); in class on subdomain app trying return response view print output testing. i hope json, when simple: echo $resp; i nothing if a: print_r( $resp ); or json_decode( $resp ); i get: http/1.1 200 ok server: nginx/1.6.2 content-type: application/json transfer-encoding: chunked connection: keep-alive x-powered-by: php/5.4.35 access-control-allow-origin: * cache-control: no-cache date: sat, 06 dec 2014 04:18:15 gmt set-cookie: laravel_session=eyjpdii6ik5dddfgk2tjq3zcvkjpqnrtzhrau2c9psisinzhbhvlijoit2txstjwyzrkuxzncg9nofzbykhoutzraug1c3nmuxlhtjf5bzyyatzryuy4s3vbmedwdjdwdxnunhkwblppv1i5yufsy2dodgnyrhh5smzyegfjcwc9psisim1hyyi6ijc0mzg3m

Store Jmeter sampler properties value using beanshell preprocessor -

i've test plan tcp sampler host , port defined using tcp sampler config. i have defined 'port' value tcp connection defined in tcp sampler config , need value (tcpsampler.port=3001) part of request server. i trying use beanshell pre-processor capture , store on user defined variable. any idea how achieve this. advanced help. put following code "text send" input tcpsampler.port=${__beanshell(ctx.getcurrentsampler().getport();,port)} broken down consists of: __beanshell function allows execute arbitrary beanshell code in place of script ctx - shortcut instance of jmetercontext class. see javadoc available methods getcurrentsampler() - aforementioned jmetercontext class method provides access instance of current sampler getport method of tcpsampler class in case tcp sampler so __beanshell function executes script , saves result port variable can later accessed anywhere in current thread group. for beanshell preprocessor (if

mysql - what is the code in php to check if user already Exist or not? -

i'm new in php , mysql. i'm trying check if user taken or not. if it's taken won't added database. however, tried lot of code trick none of code used worked. i'm not sure i'm doing wrong. have right now: <?php include 'db_settings.php'; db_connect(); //escape variables security $user = mysqli_real_escape_string($con, $_post['user']); $pass = mysqli_real_escape_string($con, $_post['pass']); $email = mysqli_real_escape_string($con, $_post['email']); $sql="insert users (user, pass, email) values ('$user','$pass', '$email')"; if (!mysqli_query($con,$sql)) { die('error: ' . mysqli_error($con)); } echo "1 record added</br>"; mysqli_close($con); echo "<a href='sign-up.html'>sing-up again!</a></br>"; echo "<a href='index.html'> go home </a>"; ?>` i know code don't have checking

Chrome localhost SSL security warning for Visual Studio 2013 web projects -

i started getting orange triangle on lock symbol when testing vs2013 ssl websites localhost in chrome. clicking on shows message: this site using outdated security settings may prevent future versions of chrome being able safely access it. research indicates caused sha-1 being gradually deprecated, replaced sha-2. how change vs2013 (or iis express) settings encrypt using sha-2?

jpeg - Simplest .jpg Display in Python 3 -

i want display .jpg (or other picture file) in python 3. pil seems have ended @ 2.7. ways i've looked use python 2. don't want change pixel values, display file on window. what's simplest way? try pillow, should work on python 2 , 3: http://python-pillow.github.io

php - Recaptcha no longer working after update to checkbox style version -

i using new version of recaptcha - 1 has check box instead of text field. however doesnt work. although new recaptcha appears, error page each time check box. i've looked through documentation , doesnt mention thing different old 1 setting up. ive downloaded latest recaptchalib.php , added <script src='https://www.google.com/recaptcha/api.js'></script> in header , have set server side script such: require_once('recaptchalib.php'); $privatekey = "myprivatekey"; $resp = recaptcha_check_answer ($privatekey, $_server["remote_addr"], $_post["recaptcha_challenge_field"], $_post["recaptcha_response_field"]); if (!$resp->is_valid) { //captcha entered incorrectly header( "location: $error_page" ); die ("the recaptcha wasn't entered correctly. go , try again." .

Yii2:Does login,signup & password reset forms work together in single view -

i using yii2 webapp. got stuck @ unique point & need help i using javascript fadein & fadeout effect show & hide form. enable effect have put 3 forms in single view & have call respective controllers(actionlogin, actionsignup & actionpasswordreset) on button click. i declared rules parameters of 3 forms 'required' validation when submit form, time not working further wants me fill other 2 form fields submit other 2 forms in same view. i put javascript code call animation here: <script> jquery(document).ready(function() { app.setpage("login"); //set current page app.init(); //initialise plugins , elements }); </script> <script type="text/javascript"> function swapscreen(id) { jquery('.visible').removeclass('visible animated fadeinup'); jquery('#' + id).addclass('visible anima

javascript - How to display result in textbox using jsp -

i have 1 jsp form in accepting product quantity , product rate user , multiplication of want show in textbox when click on calculate button. how achieve using jsp servlet. tried using javascript doesnt work. can u please suggest me something? <script language="javascript" type="text/javascript"> function netamount() { //alert("iam in java script"); var pquantity= document.getelementbyid("prodquantity").value; // document.f11.prodquntity.value; var prate = document.getelementbyid("prodrate").value; //document.f11.prodrate.value; var neta = parseint(pquantity) * parsedouble(prate); document.getelementbyid("netamount").value = neta; } </script>

php - Encryption sha512 algorithm Different values -

so have been using login , register script 3 projects , worked great. current project creating problems. generated password doesnt match 1 in db , hence couldnt login. the register page given below <?php include_once 'includes/register.inc.php'; include_once 'includes/functions.php'; ?> <html> <head> <meta charset="utf-8"> <title>secure login: registration form</title> <script type="text/javascript" src="js/sha512.js"></script> <script type="text/javascript" src="js/forms.js"></script> <link rel="stylesheet" href="styles/main.css" /> </head> <body> <?php if (!empty($error_msg)) { echo $error_msg; } ?> <form action="<?php echo esc_url($_server['php_self']); ?>" m