Posts

Showing posts from June, 2011

web services - Irrelevant syntax issue in apiblueprint -

so i've been designing rest api using apiary.io , i'm done. there syntax issue doesn't make sense @ all. have [get] action specific resource seems apiary confuses [get] action resource , says action method 'get' defined resource '/api/quotes?{sq}&{author_id}&{ratingrange}&{quoteidrange}&{authorratingrange}&{authoridrange}' here api link : https://app.apiary.io/kalematie/editor the syntax issue in line 987 i know whether i'm doing wrong or there's bug in tool. thanks in advance.

drawing - Java Pattern Design -

i trying make pattern on java: ******* ****** ***** **** *** ** * however, till have been able produce code: public class pattern { public static void main(string [] args) { int height = 7; (int = 0; <= height; i++ ) { (int j = 0; j <= ; j++) { system.out.print("*"); } system.out.println(); } } } this code can produce image: * ** *** **** ***** ****** ******* ******** what part of code should change able produce first image? thanks help, apologize if wrong question appreciate help. int height = 7; (int = height; i>=1; i-- ) { //reverse,and change '0' '1' int space_cnt = height - i; //number of space need (int j = 1; j <= height ; j++) { if(space_cnt-->0){ system.out.print(" "); }else{ system.out.print("*"); } } system.out.println(); }

R: Reformatting data file -

i have suspect simple data reformatting question. data file (txt) structured observation numbers on separate lines, 1 45 65 78 56 2 89 34 39 55 the desired output is, 1 45 65 1 78 56 2 89 34 2 39 55 suggestions on how make conversion appreciated. thanks. we read file readlines . create index variable , split 'lines'. remove first element of list elements, use read.table read file, , unnest lines <- readlines('file.txt') library(stringr) #remove leading/lagging spaces if lines <- str_trim(lines) #create index mentioned above based on white space indx <- !grepl('\\s+', lines) #cumsum above index create grouping indx1 <- cumsum(indx) #split lines , change names of list elements lst <- setnames(split(lines, indx1), lines[indx]) #use unnest after reading read.table library(tidyr) unnest(lapply(lst, function(x) read.table(text=x[-1])), gr) # gr v1 v2 #1 1 45 65 #2 1 78 56 #3 2 89 34 #4 2 39 55

php - PHPStorm - Suggestions in included HTML -

i can not see suggestion variable $data in default.phtml if include html file default.phtml class code_controller.php method. here code example. code_controller: abstract class core_controller{ protected $template; public function display(){ $data['title'] = 'title of site'; if(core_config::$is_admin){ require_once admin_templates_path . $this->template . '.phtml'; }else{ require_once public_templates_path . $this->template . '.phtml'; } } } default.phtml <!doctype html> <html> <head> <title><?php echo $data['title'] ?></title> </head> <body> content of document...... </body> </html> have idea? thanks advice. standard approach in such case: use phpdoc , declare variable there (at top of file), e.g. <?php /** @var array $data */ ?> ...html code here...

python - .kv file doesn't seem to work -

so i'm working example kivy file code, , came across code allows user switch between screens: from kivy.app import app kivy.lang import builder kivy.uix.screenmanager import screenmanager, screen kivy.lang import builder kivy.uix.screenmanager import screenmanager, screen builder.load_string(""" <menuscreen>: boxlayout: button: text: 'build scenario' on_press: root.manager.current = 'settings' button: text: 'run existing scenerio' <settingsscreen>: boxlayout: button: text: 'run existing scenerio' button: text: 'back menu' on_press: root.manager.current = 'menu' """) # declare both screens class menuscreen(screen): pass class settingsscreen(screen): pass # create screen manager sm = screenmanager() sm.add_widget(menuscreen(name='menu')) sm.add_widget(setting

xml - cant generate the right soap response description with c# -

i've built .net c# webservice. 1 of methods should return xml search resaults. my current soap description im getting when method returns xmldocument type is: soap 1.1 following sample soap 1.1 request , response. placeholders shown need replaced actual values. post /harelcybws/harelcybws.asmx http/1.1 host: safemail-t.harel-ins.co.il content-type: text/xml; charset=utf-8 content-length: length soapaction: "http://www.securenet.co.il/getsafeactivitiesxml" <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <getsafeactivitiesxml xmlns="http://www.securenet.co.il"> <safename>string</safename> <days>int</days> <filename>string</filename> &

visual studio - richTextBox make sum of all lines in c# -

is there way make sum of lines in richtextbox? lines in richtextbox numbers. want if richtextbox has 10 lines random numbers 10 lines must added each other. ex.: 1 2 3 4 5 6 7 8 9 10 then must happen is: 1+2+3+4+5+6+7+8+9+10 , answer appears in messagebox in case: 55 greetings michielvk try this: messagebox.show(string.format("sum of numbers {0}", richtextbox1.text.split('\n').select(number => convert.toint32(number)).sum())); split text on new line character, convert string array numbers, sum , display in messagebox . step step solution: string[] stringarray = richtextbox1.text.split('\n'); int sum = 0; foreach (string element in stringarray) { sum += convert.toint32(element); } messagebox.show("sum of numbers " + sum);

Crystal Reports: Conditional Font Formatting -

Image
i've been trying in vain conditional formatting working in report. i select field, right click, format field , click x+1 button right of colour. i enter this: if{@col_1_calc} < 0 crred else cryellow it doesnt seem @ all. text black. if right click, format field , select 'blue' immediate options, text blue. it seems if conditional formats just, turned off. if replace above format 'cryellow', still nothing. any suggestions trouble shooting? this may not answer, theres no other way couldhave uploaded screenshot. not sure how applying color field. how would, right click on field , use font tab. below. may using different version of crystal you.

ios - AVPlayer performance - videos are flickering when scrolling a list fast -

i have list of 60 videos i'd display on list , play while user scrolling. unfortunately when i'm scrolling list fast, view totally unusable - video players flicker , there serious delay in scrolling (e.g. app freezes half second before rendering players , shows empty cells). i tried using threads, didn't much. code snippet last tries looked way: cell.videosnippetplayerview!.hidden = true dispatch_async(dispatch_get_global_queue(int(qos_class_user_interactive.value), 0)) { cell.setvideo(urlstring, rowno: indexpath.row) dispatch_async(dispatch_get_main_queue()) { cell.videosnippetplayerview!.hidden = false } } i used local video files (resources), there no delay caused network. thanks!

c# - List View (index controller) does not update after an individual record has been edited -

i have mvc app multiple controllers reading/writing to/from ms sql database, , want consolidate database calls 1 controller (called xyzdataset.cs) instead of making calls db individual methods in each controller. the situation is: when edit individual record, upon successful database update, i'm redirected index() method list of records displayed. with scenario 1 (below), index() view displays updated list, freshly updated values. with scenario 2, index() view not display freshly updated values; however, when go record edited, see newest values - so, database gets updated. what culprit? have tried using both [outputcache(duration = 0)] , [outputcacheattribute(varybyparam = "*", duration = 0, nostore = true)] on controller , method level, not change outcome. thanks hints on solution! /*** items controller ***/ // scenario 1 - works charm, displays updated list in view after record has been updated: public actionresult index() { var itemlist = d

python - Determine condition in list of strings -

i'm used c# , writing python script. want determine if of strings in list contain string "error". in c# this: string mymatch = "error"; list<string> mylist = new list<string>(); bool matches = mylist.any(x => x.contains(mymatch)); my attempt in python tells returns true though list contains strings contain word error . def isgood (linesforitem): result = true; if 'error' in linesforitem: result = false return result sounds mean: def isgood(linesforitem): result = true if any('error' in line line in linesforitem): result = false return result or more simply: def isgood(linesforitem): return not any('error' in line line in linesforitem)

excel - Parse/Scrape from Multiple Pages using XMLHTTP in VBA -

the code below scrapes/parses 1 page of data (50 results) excel however, scrape multiple pages (500 results) - please help. (base64encode taken different source - don't take credit it) `function getdata() boolean application.screenupdating = false dim objhttp new msxml2.xmlhttp dim strurl string dim strusername string dim strpassword string sheet1.range("a2:r2000") = "" sheet1.activate strusername = "user" strpassword = "password" = 1 ubound(myarray) strurl = "https://.ngx.com/ngxcs/indexprice.xml" objhttp.open "get", strurl, false objhttp.setrequestheader "authorization", "basic " & base64encode(strusername & ":" & strpassword) objhttp.setrequestheader "host", "secure.example.com" objhttp.setrequestheader "content-type", "text" objhttp.send "nothing" while objhttp.readystate <> 4 doevents wen

Putting a List into a datatable column in c# -

i trying display values 2 different column in 1 datatable column. possible add them list , put list datatable column? datatable dt = new datatable(); dt.columns.add("fullname"); dt.columns.add("studentid"); foreach (var studentsubject in studentsubjects) { dt.columns.add(studentsubject.tostring()); } foreach (var g in groups) { datarow dr = dt.newrow(); dr["fullname"] = g.fullname; dr["studentid"] = g.studentid; foreach (var sc in g.examscore) { list<subjectproperty> listsubjectproperty = new list<subjectproperty>(); listsubjectproperty.add(new subjectproperty { subjectid = sc.subjectid, score = sc.e

jquery - In Asp.net MVC , Ajax Auto Postback failed to work properly,while using Ajax.beginform in Partial View -

to display some-text in display-box ,when user changes values in dropdownlist .for purpose used partialview , ajax.beginform , jquery.change function . issue : in main- view* using **@html.beginform() , @ajax.beginform used in partial view , while changes value in dropdownlist, jquery form submit calling @html.beginform() in main-view other @ajax.beginform expected behavior: jquery form submit should call @ajax.beginform in partial view //following scripts included in view, partial-view <script src="~/scripts/jquery-1.10.2.min.js"></script> <script src="~/scripts/jquery.validate.min.js"></script> <script src="~/scripts/jquery.validate.unobtrusive.min.js"></script> in main view @model shopping.models.mob //issue:this "html.beginform" called during submitting partial view @using (html.beginform("mobilesell", "mobilesell", formmethod.post)) { <table>

PHP script mucks up copyright -

i have written php script goes through , changes html generated visual page. (i know - old program - it.) anyway, in each of these html web pages i'm working put in: {copyright} where want copyright show up. did following loop: foreach( $file $k1=>$v1 ){ if( preg_match("/\{copyright\}/i", $v1) ){ $file[$k1] = preg_replace( "/\{copyright\}/i", $copyright, $v1 ); } } this did not work. echo out $file[$k1] before , after if statement see going on , php wouldn't change {copyright} copyright. variable $copyright had similar to: <tr><td>copyright 2007-now mycompany. rights reserved.</td></tr> now - here freaky thing: put break after did preg_replace - , - worked. changing above to foreach( $file $k1=>$v1 ){ if( preg_match("/\{copyright\}/i", $v1) ){ $file[$k1] = preg_replace( "/\{copyright\}/i", $copyright, $v1 ); break; } } made work. h

php - Printing table values in ascending order -

i trying print out users name , totalspent value in ascending order of totalspent. i.e, user has spent outputed first next highest spender etc. this current code, however, seems output single table row infinite amount of times. $query = "select * ( select * `members` order `totalspent` desc limit 10) tmp order tmp.totalspent asc"; $result = $mysqli->query($query); while ($row = $result->fetch_assoc()) { echo $row['name'] . " - $" . $row['totalspent'] . "<br/>"; } select member_name, totalspent tmp order totalspent desc; still can show snippet of table , snippet of answer desire

asp.net - How to Proceed 3D Secure transactions for cards that are stored in Vault using BrainTree API -

i have tried braintree api dotnet webform application , able create transactions successfully. got stuck in 1 of issues of setting transactions 3d secure verification cards stored in braintree vault. in api have mentioned pass nonce server , amount client side verify transaction. im unable link. im confused in accessing liability shifted concept. can have better explanation on this? i have gone through api thoroughly unable figure out issue. my requirement : need create 3dsecure transactions within applications cards enabled 3d secure. how ever if customer did not enable 3d secure should able complete transaction.(this understood passing 3d secure - required attribute false server side) need save card details in vault saved cards section. when im trying invoke 3dsecure saved cards section response.nonce generated client side same nonce generated @ server side. says nonce used. so please me in regard. in advance. srikanth i work developer @ braintree. if server ,

getting values outof a loop (Clojure) -

if make loop how possible values of variable in standard out each turn? not talking printing them on screen, because long in loop values going proceed loop , not coming out, 1 coming standard out closing value. example: (loop [x 0] (if (< x 5) (recur (inc x)) 1234567890))) 1234567890 loop ends, want 0, 1, 2, 3 , 4 std.out. well, loop not loop recursion point. if want collect values can use kind of accumulator: (loop [x 0 acc []] (if (< x 5) (recur (inc x) (conj acc x)) (conj acc 1234567890))) unless recursion want kind of map or for (list comprehension) better choice.

node.js - Creating an online search engine for large XML database (10GB - 1TB of data) with server running -

i have been using node.js create website able search google patent grant database provides data in xml format. i've been using mongodb user database, told me had lot of difficulty creating fast search engine using mongodb, said grew large. database technology/software should use in conjunction node.js create efficient search engine? bad idea have 2 different database technologies running 1 website, e.g. mongodb , postgresql? found technology called norch on github https://github.com/fergiemcdowall/norch . technology helpful? you going have hard time matching or beating lucene in text search either postgres or mongodb. solr or elasticsearch better options (they both use lucene). that being said people still store data in other search index , implement kind of synchronization between search index , data repository. edit based on comment: an example combination solr , postgres. solr search engine , postgres data repository. use dataimporthandler pull data postgre

c# - Gui Text issue not appearing -

Image
i'm having problem gui text in unity 5. trying score appear on screen. scoring system works since have debug.log output tells me works, gui text isn't showing if type text box. using unityengine; using system.collections; public class score : monobehaviour { public static int myscore; public bool allowscore = false; public guitext mytext; //only allows score start when first object has passed player object void ontriggerenter2d(collider2d collisionobject) { allowscore = true; } //add 1 score every switch void update () { if (input.getmousebuttondown (0) && allowscore == true) { myscore = myscore + 1; debug.log ("my score " + myscore + " point(s)"); } //gui text screen mytext.text = "score: " + myscore.tostring(); } } unless typo, have line of code has 2 equal signs: mytext.text = "score: " = myscore.tostring();

jQuery copy cloned rows from one table to another with added td columns -

using jquery, need copy, rows, 1 @ at time, dragging table1 table2, leaving row unchanged in table1. on dropping in table2, need add 2 new columns row dropped in table2. rows need drag/dropped in table2 rearrange them. ok adds new data column table2 sending server. following code works. problem if drop occurs before mouse on table2, columns added table1. code follows: <!doctype html> <html lang="en"> <head> <meta charset='utf-8'> <!-- <link rel='stylesheet' href='style/jquery-ui.css'> --> <script src='js/jquery-1.11.0.min.js'></script> <script src='js/jquery-ui.min.js'></script> <style type="text/css"> .tables_ui { display:inline-block; margin:2px 2%; border:2px solid #3333fe; border-spacing:0; } .tables_ui ul li { min-width: 200px; } .dragging li.ui-state-hover { min-width: 240px; } .dragging .ui-state-hover { color:green !important;

javascript - node.js express nested callback in route -

getting error "could not locate bindings file" trying search blog posting, lookup banner based on blog abbrev, write out without banner lookup, works fine think screwing callback can't find example app.get("/posting/:id", function(req,res) { var db = app.get('db'); var id = [req.params.id]; console.log(id); db.run("select * postings id=$1",[1], function(err,posting) { console.log(posting); var choice = posting[0].choice; var banner = banner_lookup(choice, function(err, banner) { console.log(banner); res.render("posting", {posting:posting[0], banner:banner}); }); }); }); function banner_lookup(abbrev) { console.log("banner lookup"); (i=0;i++;i<banners.length) { if (abbrev == banners[i].abbrev) { console.log(banners[i]); return (banners[i]); } } return {"name":"","color":"#000"}; } var banners = [{&

database - Reading from the sysaudits table - Sybase ASE 15.7 -

i trying collect audit logs sybase ase 15.7 sysaudits table. siem using query read audit logs. since sysaudits table can read users sso role , had find alternative since cannot give privilege siem. our dba tried create view purpose since account used siem not having sso role failed. dba proposed create table same structure (event, eventmod, spid, eventtime, sequence, suid, dbid, objid, xactid, loginname, dbname, objname, objowner, extrainfo, nodeid) , write script read sysaudits table , write new table every 5 minutes. went ahead solution, ran across problem why need help the siem solution read using query provided dba, siem solution needs unique column keep track of record last read. noticed there no such unique column in sysaudits. moreover, noticed commands broken multiple entries , keep track of them sequence id used. i thinking if should add auto incrementing column id. in keeping track of audit logs. for sequence id , commands broken in multiple entries, thinking per

serial port - how to save data from arduino into .YUV extension file? -

i getting data arduino mega serially thorough serial.write , want save data file .yuv extension. how accomplish that? you need create program connects com port , reads serial data in arudino , saves to file stream. have sample project coded in c# here . includes both arduino program , program runs on computer. reading serial data in c# @ serialport class. don't have use c#, can use programming language supported operating system on computer.

html - Drop down menu variable divs show on page load -

just need little on haven't been able find answer to. have drop down menu in html supposed display div image associated when drop down selection made. problem currently, load every div when page opens , hide divs when selection made. nothing shown until actual selection made if makes sense. here have far (simplified problem's sake): <select onchange="toggle_form_element(this)" name="parts" id="parts"> <option value="-">please choose image</option> <option value="0">img 1</option> <option value="1">img 2</option> <option value="2">img 3</option> </select> <span id="dropdown"> <div id="img1">image 1.jpg</div> <div id="img2">image 2.jpg</div> <div id="img3">image 3.jpg</div> </span> <script type="text/javascript"> function toggl

php - Redis pubsub with Ratchet -

i have socket configured ratchet listen messages in client this: var sock = new websocket("ws://localhost:2000"); sock.onmessage = new function(evt){ //listen redis subscribe } sock.onopen .. sock.onclose .. i trying connect redis pubsub channel , listen messages. know how subscribe redis channel in php trying figure out how configure ratchet's onmessage listen redis' subscribe. possible modify ratchet listen redis subscribe on channel? there documentation read on? not find information online. advice appreciated. there's asynchronous redis client build on react allows assign callbacks redis pubsub in non-blocking way. works ratchet. take close @ github: predis/async .

node.js - Mysql returning incorrect bigint result by one, very strange error -

Image
i don't know going on here. have database table looks this: with data: when run query select * game id = 4 in phpmyadmin result expected: but when make query on through rest api (where gameid = 4) var query = connection.query("select * game id = ? ",[game.gameid],function(err,rows){ i result where adminid reason has been subtracted one. haven't clue going on. have tried dropping table , setting up, has experienced before? or know wrong? it's pretty frustrating! thanks the maximum integer javascript can safely represent number.max_safe_integer , 2^53 - 1. value greater that, causing bits lost. node-mysql has supportbignumbers , bignumberstrings options parse bigint s strings. var connection = mysql.createconnection({supportbignumbers: true, bignumberstrings: true});

javascript - How do I keep an HTML div from moving when the one to its left is hidden? -

here's simple jsfiddle : function hidediv2() { $('.div2').hide(); } function showdiv2() { $('.div2').show(); } .div1 { height: 300px; width: 20%; background-color: red; float: left; } .div2 { height: 300px; width: 20%; background-color: green; float: left } .div3 { height: 300px; width: 35%; background-color: pink; float: left } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="div1">div1</div> <div class="div2">div2</div> <div class="div3">div3</div> <br> <div style="clear:both"></div> <button type="button" onclick="hidediv2()" name="hide">hide div2</button> <button type="button" name="show" onclick="showdiv2()">show div2</button> that c

ruby on rails - No route matches {:action=>"up_vote", :controller=>"votes", :post_id=>"1"} -

i've been receiving following error in rspec when trying upvote method pass: failures: 1) votescontroller#up_vote adds up-vote post failure/error: post( :up_vote, post_id: @post.id ) actioncontroller::urlgenerationerror: no route matches {:action=>"up_vote", :controller=>"votes", :post_id=>"1"} now can upvote , downvote when i'm on server, it's test won't work. here's code: votes_controller_spec.rb require 'rails_helper' describe votescontroller include testfactories include devise::testhelpers describe '#up_vote' "adds up-vote post" request.env["http_referer"] = '/' @user = authenticated_user @post = associated_post sign_in @user expect { post(:up_vote, post_id: @post.id) }.to change { @post.up_votes }.by 1 end end end votes_controller.rb class votescontroller < applicationcontroller before_ac

angularjs - ng-if inside ng-repeat not updating from controller -

so new angular, started right bear me please... want loop thru array , inside loop evaluate condition display html looks this: <div ng-controller="buildercontroller"> <div ng-repeat="row in formrows" class="fe-form-row"> <div class="fe-form-draggable-item"> <div class="fe-form-l-side-menu bg-primary col-md-1 pull-left"> <i class="fa fa-cog"></i> <i class="fa fa-close"></i> </div> <div class="gray-lighter col-md-11 pull-left"> <div ng-if="row.columns.length == 0"> <div ng-click="open('lg','layout')" id="fe-form-container-base" class="fe-form-r-side-menu gray-lighter col-md-12"> <div class="fe-form-insert-menu"> <i class="fa fa-plus

c# - Routing between two projects in angularjs -

Image
i looking @ article how angular app routing between 2 projects. i have 2 projects called presentation.web , security.web . in security.web have controllers authentication service. once user has been authenticated page needs redirected home page in presentation.web . how achieve using single app? or how can route between 2 apps? i'm using visual studio 2013 develop project (developing angularjs app c#) i have controller registration , sign in under security.web(highlighted in screenshot) project and have home controller , todocontroller under presentation.web project(highlighted in screenshot) when user signedin page has redirected todomanager. signincontroller: .success(function (data, status, headers, config) { $http.defaults.headers.common.authorization = "bearer " + data.access_token; $http.defaults.headers.common.refreshtoken = data.refresh_token; $cookiestore.put('_token', data.access_token);

javascript - Why does my inline style not work CSS -

i'm pretty new @ this. can't figure out why "css" fill overrides "inline" fill. #label_x, #label_y { font-size: 130% !important; } rect { fill: #4aaeea; } #chart text { fill: black; font: 10px sans-serif; text-anchor: end; } .axis text { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #aaa; shape-rendering: crispedges; } body { background: #fff; color: #eaeaea; padding: 10px; } .ch2 { fill: #e50000; } ... bunch of (d3) javascript: bar.append("rect") .attr("y", function(d) { return yscale(d.with_mobile_all); }) .attr("x", function(d, i) { return xscale.rangeband() + (padding) / 2.2; //+ x.rangeband() / 2 + (padding/2 + (i+1)*0.1) ; }) .attr("height", function(d) { return h - yscale(d.with_mobile_all) + top_padding; }) .attr("width", xscale.rangeband()) //set width base on range on ordinal data .on("mouseover"

Speed Up Working With Comments in Excel VBA -

this example contrived, created explain problem i'm having. want code run faster does. on new sheet each loop of cell starts fast, if let run near completion, , run again, hit 100ms per cell. in sheet have 16000 cells lot of comments this, , manipulated individually every time code runs. in example same, in real application each 1 different. is there anyway make process faster? option explicit public declare ptrsafe function gettickcount lib "kernel32.dll" () long public sub breakthecommentsystem() dim integer dim t long dim cell range dim dr range set dr = range(cells(2, 1), cells(4000, 8)) dim rstr string rstr = "abcdefg hijk lmnop qrs tuv wx yz" & chr(10) = 1 5 rstr = rstr & rstr next each cell in dr t = gettickcount cell if .comment nothing .addcomment else .comment .shape.textframe.characters.font .bold = true .name = "arial&qu

sql server 2008 - SQL get table columns with type name -

i have getting information of tables , columns below query. is there handy way type name description nvarchar(20) , numeric(14,2) , varchar(max) etc. instead of lot's of case statements? select o.name tablename, c.name columnname, t.name + case when t.name '%char' '(' + case when c.max_length = -1 'max' else convert(varchar(10), c.max_length / case when t.name 'n%' 2 else 1 end) end + ')' when t.name in ('numeric', 'decimal') '(' + convert(varchar(4), c.precision) + ',' + convert(varchar(4), c.scale) + ')' -- when .... many other types else '' end typename sys.objects o inner join sys.columns c on o.object_id = c.object_id inner join sys.types t on t.system_type_id = c.system_type_id , t.user_type_id = c.user_type_id o.is_ms_shipped = 0 order o.name,

mysql - Adding in a PHP email to a file that has info sent with an AJAX call killing code -

i created code updates user's group level(permission level). send selected id , group level via ajax php file called user_update_group. updating user's group # worked before tried add php email in same file. i'm doing because getting user's info database, thought best approach. however, when adding in email breaks code. there in php file killing or can not way? trying select data in users table id brought on , send email out them using same button other query used. php email second part in php file added in here. added in of code show trying do. <?php $con2 = mysqli_connect("localhost", "root", "", "db"); $run2 = mysqli_query($con2,"select * user_requests order id desc"); $runusers2 = mysqli_query($con2,"select * users order id desc"); $numrows2 = mysqli_num_rows($run2); if( $numrows2 ) { while($row2 = mysqli_fetch_assoc($run2)){ if($row2['status'] == "approved&

ios - Unable to set background image for UICollectionView -

i have been trying add custom background image app. used methods introduced here: how fill background image of uiview these codes succeeded in both normal uiviewcontroller , uitableviewcontroller, failed in uicollectionviewcontroller. black. as far understand, uitableviewcontroller has similar structure uicollectionviewcontroller. compared setting these 2 controllers , same (in view section). how come code works on 1 not on other one? the best way implement implement through code inside viewdidload collectionview let bgimage = uiimageview(); bgimage.image = uiimage(named: "bg4"); bgimage.contentmode = .scaletofill self.collectionview?.backgroundview = bgimage

vb.net - Using the same file error -

on button click have following code write in textboxes. dim file system.io.streamwriter file = my.computer.filesystem.opentextfilewriter("c:/users/nick/documents/dra.txt", false) file.writeline(namebasic) file.writeline(lastbasic) file.writeline(phonebasic) file.writeline(nameemer1) on form load, load in notepad written, saying being used(the file) true, how can have 2 different functions(write, , read) manipulating same file out error? the process cannot access file 'c:\users\nick\documents\dra.txt' because being used process. and here code onformload dim read system.io.streamreader read = my.computer.filesystem.opentextfilereader("c:/users/nick/documents/dra.txt") lblnamebasic.text = read.readline i sort of stuck on problem, thank you you need close file when done writing it. dim file system.io.streamwriter file = my.computer.filesystem.opentextfilewriter("c:/users/nick/documents/dra.t

php - Is the database created in MySQL with terminal different from the database that show in the PhpMyAdmin? -

i sorry if question sounds bit stupid because new php , mysql. so, please bare me. i have created database in mysql terminal, , tried find in phpmyadmin couldn't find it. question is, 2 databases different each other or did wrong why didn't show up? any advice appreciated. phpmyadmin web gui acts client interacting mysql server . in terminal, access server using mysql command-line client , , create database on server . now, both of these clients can configured use mysql server can access on network. command-line client defaults connecting 127.0.0.1 on port 3306 (or /var/run/mysql.sock that's unimportant in case). in phpmyadmin, config.php defines server connect to. don't remember defaults, servers configured via $cfg['servers'] . this document explains configuration. so, should able @ config.php , determine whether or not you're connecting 127.0.0.1 port 3306. another possible reason might not see db in phpmyadmin if only_db s

Why does the yield function not require parentheses in Python? -

in python, have many times seen yield function used create generator. both , print function technically both perform action of methods because return value. however, during change python 2 python 3, print function gained parentheses normal method call, yield stayed same. also, yield gains yellowish color of reserved keyword while print purple of reserved method. why yield not considered method , colored way along not using parentheses syntax? (in similar vein, why return lack parentheses?) let me add more stuff, yield , continue not given parentheses in many other languages well. wanted know makes different other reserved. there many other reserved methods out there parentheses. so went digging answer. and turns out, there one . pep 255, pep gave yield keyword q. why new keyword "yield"? why not builtin function instead? a. control flow better expressed via keyword in python, , yield control construct. it's believed efficient

sql - Oracle date datatype vs sysdate -

in table sales there expiry date field of date type. now, have write query selects records having expiry date greater current system date. select * sales expiry_date > sysdate; in output getting all records expiry date 31/12/9999 00:00:00 , not desired. " in output getting records expiry date 31/12/9999 00:00:00 not desired." but that's query asks for: must admit year 9999 greater current year. so either query correct , have misunderstood requirement, or need re-write query explicitly exclude records maximum date. presumably in case expiry_date defined not null , late change when raised matter of records never expire. instead have magic value of 31-12-9999 ,which means of "these records not expire". anyhow, here query now: select * sales expiry_date > sysdate , expiry_date != date '9999-12-31'; this common problem magic values: offer quick fix architectural problem levy ongoing tax on application logic.

ios - Collection View in Objective C -- unknown error -

Image
i following this tutorial. has me using nibs/xibs(?) opposed storyboards or programmatic approach. have followed tutorial until first build instead of compiling message in console , instead of proper collection view 200x200 cells 1 button crashing app if clicked. unknown class _ttc4test3box in interface builder file. i wonder if how setup xibs causing problem not familiar graphical elements in xcode xibs or storyboard. i'd know how approach this. if more info needed can upload project github. one of objects in nib has class name _ttc4test3box . check text field , if find 1 value, delete string. as button, i'm guessing selector being executed on button tap isn't implemented. check action property of button in ib (or in code), , ensure method body exists. check target correct too.

android - Performing Matrix.mapPoints() in both directions -

Image
in word game use matrix define scrolling offset , scaling of image representing game board: when play letter tiles game board, convert screen coordinates (the finger touch coordinates in ontouchevent ) game board coordinates (to know put tile) following method: public pointf screentoboard(pointf screenpoint) { float[] point = new float[] {screenpoint.x, screenpoint.y}; matrix inverse = new matrix(); mmatrix.invert(inverse); inverse.mappoints(point); float boardx = point[0]; float boardy = point[1]; return new pointf(boardx, boardy); } my question is: how opposite conversion? i.e. when move letter tiles game board blue bar @ bottom of screen (for example when cancelling turn) - how can please convert game board coordinates screen coordinates? the android doc on mappoints method very scarce. okay, found solution: public pointf boardtoscreen(pointf boardpoint) { float[] point = new float[] {boardpoint.x, boardpoint.y}; mma

javascript - angular controller variable changes when set afterwards? -

var jem = 55; var app = angular.module("store",[]); app.controller("storecontroller",function(){ this.product = jem; }); jem = 0; <!doctype html> <html ng-app="store"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> <meta charset="utf-8"> <title>js bin</title> </head> <body ng-controller="storecontroller store"> <p>{{"hi"}}</p> <p>{{store.product}} </p> </body> </html> why output "0" instead of "55"? since jem basic javascript variable when product assigned jem gets value copied , should not change when jem changed? notice controller definition inside callback function (as should be...) app.controller("storecontroller", function(){ this.product = jem; }); a side effect of this

html - Multiple CSS-files doesn't work -

i've created simple page bootstrap. (i have 1 bootstrap component) i've added css file doesnt work while bootstrap.min.css included. anybody knows why? my page: <html> <head> <link rel="stylesheet" href="css/mystyle.css" type="text/css"> <-- won't work <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <-- while included <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <title>testdev</title> </head> <body> <div class="well"> <p>welcome</p> </div> </body> </html> mystyle.css body{ background-color: darkred; } .well{ background: red; }

create shape xml file in drawable folder in android studio -

i using android studio 1.2.2 , need know how create new shape file in drawable folder. have done same in eclipse unable in android studio 1.2.2 follow these steps create drawable folder in res directory.(if not present) right click on drawable folder> new > drawable resource file give file name , change root element shape . (its selector default) now go.

c# - ASP.NET Save Image in ashx handler -

i have simple handler (ashx) receives base 64 encoded image , want save image. here code: sub processrequest(byval context httpcontext) implements ihttphandler.processrequest dim imageinfo = context.request("imgdata") dim imagedata string() = imageinfo.split(",") ' check there 2 parts; ie header , string data. if imagedata.length < 2 context.response.write("error") return end if ' example of imageinfo ' data:image/png;base64,ivborw0kggoaaaansuheugaaae... dim imagetype string = imagedata(0) dim imagestring string = imagedata(1) if imagetype <> "data:image/png;base64" context.response.write("error") return end if imagestring = imagestring.replace(" ", "+") dim bytes byte() bytes = convert.frombase64string(imagestring) dim image system.drawing.image using ms memorystream = new memorystrea