Posts

Showing posts from April, 2012

R knitr - kable table html formatting for small text -

Image
i trying format table in r markdown (compiling html) using knitr::kable small possible. perhaps making text smaller example. googling around lot have figured out how control these individual elements, table stays same size. thought should smaller elements required less space, did not happen. so else have set make table smaller? here code: --- title: "kable table formating" output: html_document --- <style type="text/css"> <!-- td{ font-family: arial; font-size: 4pt; padding:0px; cellpadding="0"; cellspacing="0" } th { font-family: arial; font-size: 4pt; height: 20px; font-weight: bold; text-align: right; background-color: #ccccff; } table { border-spacing: 0px; border-collapse: collapse; } ---> </style> ```{r echo=t} library(knitr,quietly=t) n <- 14 m <- runif(n*n) dim(m) = c(n,n) df <- data.frame(m) kable(df,padding=0) ``` and here outp

php - Grunt-wiredep done without errors but doesn't inject dependencies -

i'm trying connect wiredep project, no success. have bower_components , bower.json inside assets/, , gruntfile.js in root directory. here's relevant gruntfile: wiredep: { target: { src: [ 'grunt-test.html', 'application/views/inc/inc_scripts.php', 'application/views/inc/inc_head.php' ], directory: 'assets/bower_components', bowerjson: 'assets/bower.json', filetypes: { php: { block: /(([\s\t]*)<!--\s*bower:*(\s*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi, detect: { js: /<script.*src=['"](.+)['"]>/gi, css: /<link.*href=['"](.+)['"]/gi }, replace: { js: '<script src="{{filepath}}"></script>', // <-- change line cs

php - Trying to make a counter everytime I click a button -

so whenever click button counter go , save mysql database. heres have far doesn't echo number gives no errors. try { $db = new pdo('mysql:host=localhost;dbname=mydatabse;charset=utf8', 'myusername', 'password'); } catch(exception $e) { die('error : '.$e->getmessage()); } if( isset($_post['clicks']) ) { $sql = "update clicks set clicks=clicks+1"; $result - $db->query($sql); } $row = $db->query('select * clicks'); while ($data = $row->fetch()) { echo $data["clicks"]; } i don't know if clicking part works either due nothing ebing echoed... the sql table is: big int 20 clicks fix this: $result - $db->query($sql); to this: $result = $db->query($sql);

python - Why is the error handling not working for None input? -

def copy_list(t): try: if type(t) list: t_copy=[] n=len(t) i=0 while i<n: t_copy.append(t[i]) i+=1 return t_copy except typeerror: return "not list" the problem says should write function takes list of integers input , returns copy of it. should raise exception if input not list. unable understand why code unable raise exception if value not of list type or when input none? the try/except block used gracefully handling exceptions thrown interpreter when unexpected or illegal value encountered, not raising exceptions intentionally. want raise keyword. see question: how use "raise" keyword in python as suggestion, code this: def copy_list(t): if isinstance(t, list): t_copy=[] n=len(t) i=0 while i<n: t_copy.append(t[i]) i+=1 return t_copy else: raise exception('not list') edit: th

ruby - What is ivar in Rails controller? -

i can see ivar term mentioned many times here https://github.com/rails/rails/issues/18950#issuecomment-77924771 can't find straight forward explanation ivar. what , can term used outside controller context? ivar stands instance variable. instance variable bound object of given class and, in rails, used in controllers , views. this github issue have posted: 'ivars serve recommended "api" between controllers , views.' for example in controller: def new @post_ivar = post.new end you can use 'ivar' in view new action, i.e. new.haml: = form_for @post_ivar |f| = f.text_field :headline -# ...

hadoop - Shell Script to copy directories from hdfs to local -

i'm looking shell script should copy directory (with files under) hdfs local system. i think pointless write whole script, when need write 1 command terminal. with hadoop fs -ls /mydir/path you can verify name , path directory, want copy , write hadoop fs -get /mydir/path to file local. can specify destination directory by hadoop fs -get /mydir/path /mylocal/destdir it copies while directory (with subdirectories) working directory or specified directory. can file file (dir dir) with hadoop fs -get /mydir/path/* or specific dirs or files in 1 command hadoop fs -get /mydir/path/dir1 /mydir/path/dir2 . to directory. tried on hadoop vm , works fine.

Java ImageIcon doesn't work -

i have troubles when try display image in jpanel . import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.imageicon; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; public class mainwindow { public static jframe mainframe; public static jpanel loginregisterpanel; public mainwindow() { mainframe(); loginregisterpanel(); } public void mainframe() { mainframe = new jframe(); mainframe.setsize(640, 480); mainframe.setvisible(true); mainframe.setdefaultcloseoperation(jframe.exit_on_close); mainframe.setresizable(false); } public void loginregisterpanel() { loginregisterpanel = new jpanel(); loginregisterpanel.setlayout(null); mainframe.add(loginregisterpanel); jbutton loginbutton = new jbutton("login"); jbutton registerbutton = new jbutton("

linux - Custom shaped standalone windows app using Electron -

Image
i wondering if possible launch custom shaped independent window/element electron app. chat heads have facebook app in android. where should start? if not in electron possible other html framework matter. an example seen in android. looking @ having in mac/windows/linux i think looking frameless-windows in electron. when construct browserwindow object pass transparent: true option. var win = new browserwindow({ transparent: true}); if don't want frame around window might want pass frame: false option well. var win = new browserwindow({ transparent: true, frame: false}); note: unfortunately, can't click through frame-window of yet, still working on it. read more here .

javascript - Orbeon forms - how to change default behaviour of Orbeon Action -

currently in orbeon forms , when define orbeon action (for example) react value being changed on form, can specify service action call while providing input parameters. also, can specify want service response , how want use data received, e.g. maybe populate other form field. i have situation orbeon forms used part of hybris commerce suite, , need trigger service call after fields change, perform logic on server-side , reload original page (where form located). since orbeon builder doesn't offer me functionality, can give me hints/inputs of how can achieved? in other words, can override default orbeon builder functionality let me reload page when response received server? if using regular html forms js/jquery wouldn't issue, i'm not sure how orbeon handles this. thanks in advance assuming you're using form builder services , actions , plugin own javascript after service ran, in form builder, edit source of form , , add following before </xf:mo

PHP newer version fails decoding json "version like" string (ex: "0.7.4"->"0.7") -

executing code in php expect string "0.7.4" remaining "0.7.4" https://3v4l.org/gx4vm $value = "0.7.4"; if(!empty($value)) { $jsonvalue = json_decode($value); if(!empty($jsonvalue)) $value = $jsonvalue; } print_r( $value,false); and true every php version in aws php 5.6.9, , in php sandbox (5.6.4 ?), i'm getting 0.7 http://ideone.com/2uuohw in code $value can deserializable string or simple string ("['a','b']", "{'a':'10'}", "abc", "2500", etc.) , expect json decode properly. have no idea how avoid strange issue. any idea? thanks as stated, 0.7.4 not valid json (according json spec), php's json_decode can decode scalar values , too. php implements superset of json specified in original » rfc 4627 - encode , decode scalar types , null. rfc 4627 supports these values when nested inside array or object. from: http://php.net/json_decode i

excel - How to loop through rows in table using a function -

i'm creating test plan template work contains table various fields each row being identified "test no" column. when adding test case, want check see if test case has been entered in table. im attempting using function passes in parameter test case number being entered. want loop through rows , if matching case found, want error message displayed , exit sub. have far doesnt seem work. function: function existingtest(x variant) boolean dim intstartrow integer dim intstartcol integer dim introwcount integer dim intcolcount integer dim testtable string testtable = "tests" introwcount = range(testtable).rows.count intcolcount = range(testtable).columns.count intstartrow = range(testtable).rows(0).row intstartcol = range(testtable).columns(1).column existingtest = false = 1 introwcount if range(testtable).rows(i).columns(1).value = x existingtest = true exit en

testing - Easy to set DTC -

i working vehicle diagnostics , can, have run problem when trying testing. there nothing wrong vehicle using. need find either harmless , reversible problem can create on vehicle set trouble code me read, or need find way artificially set one. not sure latter possible. know there plenty of things can cause trouble vehicle, trying find won't permanently damage vehicle. i know trouble codes aren't universal across vehicles, or @ least not of them are, figured there must common problem vehicles set dtc for.

assembly - How do I get my input value to become my eax and equal a given hex value? -

i have compiled c file run program shows main. have dumped assembly code , need getting past cmp @ 8048daf. have found amount of leading zeros eax equal value cant equal 0x338. since takes input string understanding eax have either 2, 4, etc numbers value because chars 2 values hex. 0000000000000000000000000000000000008 this value have used input eax equal 0x38 08048d7d <phase_5>: 8048d7d: 55 push %ebp 8048d7e: 89 e5 mov %esp,%ebp 8048d80: 83 ec 48 sub $0x48,%esp 8048d83: c6 45 f1 00 movb $0x0,-0xf(%ebp) 8048d87: c6 45 e2 00 movb $0x0,-0x1e(%ebp) 8048d8b: c6 45 e1 e5 movb $0xe5,-0x1f(%ebp) 8048d8f: c6 45 e0 e9 movb $0xe9,-0x20(%ebp) 8048d93: c7 45 ec 38 03 00 00 movl $0x338,-0x14(%ebp) 8048d9a: 8b 45 08 mov 0x8(%ebp),%eax 8048d9d: 89 44 24 04 mov

Best practice in `Date` exchange between Java and JavaScript, considering the DST -

i'm writing web application needs transfer date between java , javascript. firstly, used milliseconds exchange date, mentioned here: https://stackoverflow.com/a/1007854/4675827 . however, there problem when came across dst, named daylight saving time. millisecond value java , javascript different sometimes. when store date part of date, saved time as: "2015-10-15 00:00:00", when pass millisecond value javascripts, became "2015-10-14 23:00:00". thus, date part has 1-day difference. i'm wondering what's best practice exchange date data between java , javascript, or can turn off dst in java? thanks in advance! finally, i able disable dst changing timezone settings of jackson mapper, used serialize , deserialize json objects. i changed gmt+8, beijing time. doesn't use dst @ all. mapper.settimezone(timezone.gettimezone(zoneid.of("gmt+8"))); you don't provide criteria "best practice", robust way transfer

java - ParseQuery - Properly handling IndexOutOfBoundsException - Parse.com? -

how 1 handle throwindexoutofboundsexception? basically, i'm querying user. if user exists, shows profile. however, if no entry found crashes app , throws exception. should put in "else" statement app doesn't crash? @override public void done(list<parseuser> parseusers, parseexception e) { if (e == null) { // query successful. parseuser user = parseusers.get(0); string userid = user.getobjectid(); showprofileactivity(userid); } else { // query unsuccessful. } } }); here logcat: 10-14 21:27:06.888 28595-28595/com.app.social e/androidruntime﹕ fatal exception: main process: com.elgami.customizer, pid: 28595

sql - Select qry to using 2 databases -

i have below query: select --a.dateentered, --a.inventoryid, a.sku, a.qtyonhand, b.dateentered vdateentered, b.golive, b.dateonsite, b.costprice, --a.currentprice, m.name status, hrf.category, hrf.department, hrf.brandedob, hrf.division, hrf.fascia, (a.qtyonhand * b.costprice) cost_value, null item_quantity, null item, null season, hrf.company, (a.qtyonhand * b.currentprice) sellilng_value, b.merchandisingseason, b.costprice costprice_rp, b.currentprice, b.inventoryid, -- a.averageunitcost, -- a.averageunitcost rp_stk_averageunitcost, -- a.currentprice rp_stk_current_price, -- a.statusid, -- a.quantity_sign, (a.qtyonhand * b.costprice) cost_value_rp, (a.qtyonhand * b.averageunitcost) awc_value -- a.stockreconciliationid, -- a.averageunitcost, [dbo].[fc03qty] join dbo.inventory b on a.sku = b.sku left join (------hierarchy------- select

plsql - oracle prompt before declare gives error -

prompt ------------------------------------------------ prompt executing...ddl/script name.sql prompt ------------------------------------------------ set serveroutput on; set verify off; whenever sqlerror exit ; whenever oserror exit ; prompt ddl/jira-id checking columns updt_userid, time_stamp, last_action null values. declare v_error boolean := false; v_exit exception; begin --- code end; while running code getting error @ line prompt ddl/jira-id checking columns updt_userid, time_stamp, last_action null values. error below. ddl/fnd-18918 checking columns updt_userid, time_stamp, last_action null values. prompt ddl/fnd-18918 checking columns hist_userid, hist_time_stamp, hist_action null values. * ora-06550: pls-00103: encountered symbol "ddl" when expecting 1 of following: := . ( @ % ; symbol ":=" substituted "ddl" continue. ora-06550: pls-00103: encountered symbol "checking" when expect

swift - usedRectForTextContainer size bug with NSAttributedString? -

Image
i attempting calculate minimum height needed nstextview 's content @ set width through following process (where self instance of nstextview ): let currentwidth = self.frame.width let textstorage = nstextstorage(attributedstring: self.attributedstring()) let textcontainer = nstextcontainer(containersize: nsmakesize(currentwidth, cgfloat.max)) let layoutmanager = nslayoutmanager() layoutmanager.addtextcontainer(textcontainer) textstorage.addlayoutmanager(layoutmanager) layoutmanager.glyphrangefortextcontainer(textcontainer) let newsize = layoutmanager.usedrectfortextcontainer(textcontainer) heightconstraint.constant = newsize.height the string created through conversion markdown nsattributedstring : let data = styledhtml.datausingencoding(nsutf8stringencoding, allowlossyconversion: false) let attributed = try! nsattributedstring(data: data!, options: [ nsdocumenttypedocumentattribute: nshtmltextdocumenttype ], documentattributes: nil) self.textstorage?.setattributedstr

sql - Function Add Month in informix -

i need function adds current date 1 month. so: let _date = mdy(month(current_date)+1, day(current_date), year(current_date)); but there problem months in days <31 you'll need check whether works in version, should result want if have sufficiently modern version of informix (11.70.fc5 or later, or version 12.10.fc1 or later) , use datetime arithmetic. let next_month = extend(current_date, year day) + 1 units month older versions of informix baulk if day out of range target month. testing on 12.10 server, used sql: create table dl (dv date not null primary key); insert dl values('2012-01-28'); insert dl values('2012-01-29'); insert dl values('2012-01-30'); insert dl values('2012-01-31'); insert dl values('2012-02-01'); select dv, extend(dv, year day) + 1 units month dl; given run dbdate=y4md- set in environment, output was: 2012-01-28 2012-02-28 2012-01-29 2012-02-29 2012-01-30 2012-02-29 2012-01

angularjs - angular function called before two way binding complete -

in custom angular directive i'm receiving method parameter. when user changes value in directive update directive's ngmodel , execute function. apparently there usecase function passed uses ngmodel used directive. reason model doesn't update when function called, later. is there way execute method once ngmodel's 2 way binding has taken place? you check if ngmodel undefined in directive's update method. function update(){ if(ngmodel !== undefined){ passedinfunction(); } }

ios - changing tableview height at runtime -

hlo, i'm creating menu tableview , toggling visibility on button click. i'm changing height actually.but changing height of tableview affecting tableview not cells inside it. tableview have shadow, if remove shadow works perfectly. please help. here code fragment let _initialtableframe = cgrectmake(self.view.frame.size.width - 150, 68, 140, 0) _topmenutableview = uitableview(frame: _initialtableframe) _topmenutableview.delegate = self _topmenutableview.datasource = self _topmenutableview.rowheight = 35 _topmenutableview.tag = 100 _topmenutableview.alpha = 0.9 _topmenutableview.tablefooterview = uiview() _topmenutableview.scrollenabled = false _topmenutableview.layer.cornerradius = 5 _topmenutableview.layer.shadowcolor = uicolor.blackcolor().cgcolor _topmenutableview.layer.shadowoffset = cgsizemake(0, 0) _topmenutableview.layer.shadowradius = 5.0 _topmenutableview.layer.shadowopacity = 1 func toogletopmenu() { if _i

android - Cannot resolve method getActivity() in a class extending FragmentActivity -

i have extended fragment activity in class need have custom toolbar. so,i added code toolbar setsupportactionbar(toolbar) did not work.then, added appcompatactivity.getactivity() cast did not work well. here code - public class main_fragment extends fragmentactivity implements fragmentdrawer.fragmentdrawerlistener { private toolbar toolbar; private fragmentdrawer drawerfragment; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_fragment); toolbar = (toolbar) findviewbyid(r.id.tool_bar); ((appcompatactivity) getactivity()).setsupportactionbar(toolbar); ((appcompatactivity) getactivity()).getsupportactionbar().setdisplayshowhomeenabled(true); drawerfragment = (fragmentdrawer) getsupportfragmentmanager().findfragmentbyid(r.id.fragment_navigation_drawer); drawerfragment.setup(r.id.fragment_navigation_drawer, (drawerlayout) findviewbyid(r.id.drawer_layout), toolb

Virtuoso with DbPedia on Amazon: Connection refused -

i have tried install virtuoso machine dbpedia data run dbpedia endpoint on own server. have followed in guide . though, every time try access endpoint using url http://ec2-ami-public-dns-cname/resource/bob_marley or http://ec2-ami-public-dns-cname/ , connection_refused response. i tried using wget inside machine , still got same response. why that? that instance-backed ami built in 2008 , last substantially updated in 2012, based on virtuoso 6, , populated dbpedia 3.8. guide linked needed number of related updates, in progress. i think happier today current, ebs-backed, pay-as-you-go ami, based on virtuoso 7, , populated dbpedia 2015 a/k/a dbpedia 3.10 . also... future reference, assistance virtuoso , other products openlink software (my employer) delivered more , accurately through virtuoso users mailing list , our public support forums , , confidential support cases

machine learning - Dealing with unbalanced datasets in Spark MLlib -

i'm working on particular binary classification problem highly unbalanced dataset, , wondering if has tried implement specific techniques dealing unbalanced datasets (such smote ) in classification problems using spark's mllib. i'm using mllib's random forest implementation , tried simplest approach of randomly undersampling larger class didn't work expected. i appreciate feedback regarding experience similar issues. thanks, class weight spark ml as of moment, class weighting random forest algorithm still under development (see here ) but if you're willing try other classifiers - functionality has been added logistic regression . consider case have 80% positives (label == 1) in dataset, theoretically want "under-sample" positive class. logistic loss objective function should treat negative class (label == 0) higher weight. here example in scala of generating weight, add new column dataframe each record in dataset: def ba

winapi - Repeat message in Mouse Proc C++ Win32 -

i have procedure when user press ctrl button , right click show message box screen. has loop, press ctrl button , right click once time shows sequence of message box. how fix this? https://youtu.be/lzi9m_zeekq this mouseproc procedure #define export __declspec(dllexport) unsigned char keystate[256]; lresult export callback mouseproc(int ncode, wparam wparam, lparam lparam) { if (ncode < 0) return callnexthookex(hhook, ncode, wparam, lparam); getkeyboardstate(keystate); if (ncode == hc_action) { if ((wparam == wm_rbuttonup) && (keystate[vk_control] & 0x80)) { messagebox(null, l"ctrl + right click", l"mouse hook", mb_ok); } } return callnexthookex(hhook, ncode, wparam, lparam); } thanks reading. you shall not use messagebox() in message hooks breaks normal message hook flow - messagebox() runs own mo

Why setting a variable in a iframe works in pure Javascript way but not in Jquery? -

Image
this question has answer here: can't append <script> element 16 answers i'm trying add variable in iframe, works in javascript way not want in jquery way. here jsfiddle . pure javascript way: var iframedocument = $('#iframe')[0].contentwindow.document; var scriptobject = iframedocument.createelement("script"); scriptobject.type = "text/javascript"; scriptobject.innerhtml = "var variable=9;"; iframedocument.body.appendchild(scriptobject); result okay in console (variable set , equals 9 , iframe context) : and when try change value of variable in jquery: $('#iframe').contents().find('body').append($('<script type="text/javascript">').html('variable=10;')); the variable loaded in parent context , didn't change in iframe! i know javascript way better jq

How can I integrate OWIN Authentication Middleware and Sitecore -

i have implemented mvc application running sitecore. startup class of owin have implemented following that: [assembly: owinstartupattribute(typeof(webapplication1.startup))] namespace webapplication1.web { public class startup { public void configuration(iappbuilder app) { configureauth(app); } public void configureauth(iappbuilder app) { app.createperowincontext<appidentitydbcontext>(appidentitydbcontext.create); app.createperowincontext<appusermanager>(appusermanager.create); app.createperowincontext<approlemanager>(approlemanager.create); app.useoauthbearertokens(new oauthauthorizationserveroptions { provider = new appoauthprovider(), allowinsecurehttp = true, tokenendpointpath = new pathstring("/authenticate") }); } } } i have expected when submit username, password , grant_type v

android - Is it good to replace broadcast receiver with Greenrobot Eventbus for triggering event based functions and data transfer from service to activity? -

i have implemented service, handle state changes(connect, disconnect, onservicediscoverd, oncharacteristicchange etc) , receiving data device through gatt server. my question is, can events handled efficiently using greenrobot eventbus replacing broadcast receiver between service , activity ? unlike localbroadcastmanager, eventbus more simpler use. go via 3 steps: 1- create event class. simple java class represent response when action occur. 2- register event bus subscriber in activity oncreate method eventbus.getdefault().register(this); and of course, unregister in activity ondestroy method eventbus.getdefault().unregister(this); 3- subscribing method created in same activity registered eventbus. example in workorderactivity @subscribe public void onevent(eventclass event) when event occur, should call post method, passing event object created before. eventbus.getdefault().post(new eventclass (data)); as kmaini mentioned, can replace l

angularjs - $cordovaSQLite.execute is not a function in ionic -

in code $cordovasqlite.execute function works in .run function gives me error in controller . don't know doing wrong , have included required plugin , follow step of example https://blog.nraboy.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/ var db = null; var myapp=angular.module('starter', ['ionic','btford.socket-io','logincntrl','slidecntrl','app','chatcntrl','ngcordova','ngcordova.plugins.sqlite']) .run(function($ionicplatform,$cordovasqlite) { $ionicplatform.ready(function() { // hide accessory bar default (remove show accessory bar above keyboard // form inputs) if(window.cordova && window.cordova.plugins.keyboard) { cordova.plugins.keyboard.hidekeyboardaccessorybar(true); } if(window.statusbar) { statusbar.styledefault(); } console.log("the application resuming background");

Get Chinese data form the clipboard with a parser in C# -

what dataformat should use if have parse data in clipboard contains chinese? currently i'm using following code parse data datagrid . object clipboardrawdata = null; parseformat parseformat = null; idataobject dataobj = system.windows.clipboard.getdataobject(); if ((clipboardrawdata = dataobj.getdata(dataformats.commaseparatedvalue)) != null) { parseformat = parsecsvformat; } else if ((clipboardrawdata = dataobj.getdata(dataformats.text)) != null) { parseformat = parsetextformat; } string rawdatastr = clipboardrawdata string; rawdatastr returns gibberish if clipboard data in chinese simply use dataformats.unicodetext . dataformats.text try use ansi encoding fail on chinese symbols.

xcode - How to link libs in Xcode7 -

Image
i update xcode 7.0. build project errors below.i have try solution add lib "libsqlite3.dylib" , "libz.dylib" "link binary libraries" manually. doesn't work. error: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/libtool: can't open file: /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk/usr/lib/libsqlite3.dylib (no such file or directory) error: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/libtool: can't open file: /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk/usr/lib/libz.dylib (no such file or directory) you need remove references .framework , .dylib files under xcode 7. libcocos2d static library , therefore there no link phase. can link in .framework , .dylib files in game's project file.

php - paypal sandbox testing not working -

Image
i'm doing paypal sandbox testing i'm not able that. i'm using dummy creditcard numbers, everytime error. i've attached image of error. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" name="frmpaypal1"> <input type="hidden" name="business" value="abc-facilitator@ratufa.com"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="item_name" value="phpgang payment"> <input type="hidden" name="item_number" value="1"> <input type="hidden" name="credits" value="510"> <input type="hidden" name="userid" value="1"> <input type="hidden" name="amount" value="10"> <input type="hidden" name="cpp_he

excel - Get the last column character dynamically and pass it -

excel vba: trying last column character dynamically , pass last column while selecting range sorting. doesn't seem work here code sub sort_that_is_not_called_sort_because_that_is_a_reseved_word() dim lastrowcheck long, n1 long, lastrowcheck1 long, n2 long dim lcol integer, colletter string worksheets("mergesheet") lastrowcheck = .range("a" & .rows.count).end(xlup).row n1 = 2 lastrowcheck if .cells(n1, 1).value = "fund" .rows(n1).delete end if next n1 activeworkbook.worksheets("mergesheet").sort.sortfields.clear activeworkbook.worksheets("mergesheet").sort.sortfields.add key:=range( _ "a2"), sorton:=xlsortonvalues, order:=xlascending, dataoption:= _ xlsortnormal activeworkbook.worksheets("mergesheet").sort lcol = cells(1, columns.count).end(xltoleft).column

java - Oracle WCC Set Date Field to Null With RIDC -

i'm trying make update oracle wcc server via ridc java based application. i've tried: dataobject.put("doutdate", null); returns: unable update content item information 'my_content_id'. expiration date not valid. unable parse date 'null'. so how can update date field null content item using ridc ? i able update passing in " " instead of null. code looks dataobject.put("doutdate", " "); i'm not sure that's best approach, worked.

curl - Get request domain using php -

i have problem getting domain name using http_referer. condition this: http://www.example.com send curl post server. things is, example.com not send url in curl_setopt(curlopt_referer) . possible on server side domain name ? thanks lot helping me my code far: on abc.com side $data = array('username' => $username , 'email' => $email, 'phone' => $phone ); $string = http_build_query($data); // debugging purpose // echo $string; $ch = curl_init("http://localhost/test/str_pos.php"); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $string); curl_setopt($ch, curlopt_returntransfer, true); curl_exec($ch); curl_close($ch); header("location: str_pos.php"); on server side: $domain = parse_url($_server['http_referer']); if (isset($domain['host'])) { echo $domain['host']; } else{

c++ - Working with pointer to pointer -

i have binarysearchtree struct: struct bstnode { int value; bstnode *left = nullptr; bstnode *right = nullptr; }; struct bst { bstnode *root = nullptr; }; and functions work tree: bstnode **findposition(bstnode *node, int value) { if (value < node->value) { if (node->left) { return findposition(node->left, value); } else { return &node->left; } } if (value > node->value) { if (node->right) { return findposition(node->right, value); } else { return &node->right; } } return &node; } void remove(bstnode** position, int value) { if ((*position)->left == nullptr && (*position)->right == nullptr) { delete (*position); *position= nullptr; } } void remove(bst &bst, int value) { bstnode **position = findposition(bst.root, value); if (*position != nullptr) {

node.js - Object Factory Node Module with nested Objects using Generators -

i'm writing object factory node module in es6. i'm using stamptit library https://github.com/stampit-org/stampit base objects started enhance them , return own objects through factory. lets have these 2 files in '../../models/': mybasejsondata.json { "addresses": { "type": "addressjsondata.json", "multi": true, "required": true }, . . . } addressjsondata.json { "street_name": "sample", "zip_code": "75024" . . . } this current code comments: import stampit 'stampit'; import * fs 'fs'; // allows me run node's async internal functions generator function runnodefunc( gen, iter) { (iter = gen((err, data) => (err && iter.throw(err)) || iter.next(data))).next(); } // loop through object's keys , values function* objectentries(obj) { let propkeys = reflect.ownkeys(ob

php - Laravel object_get -

i have base user model object. each user can either staff member, parent or student. each account type has associated model. for example: class user extends model { public function details() { switch($this->account_type) { case 'staff': return $this->hasone(staff::class); case 'student': return $this->hasone(student::class); case 'parent': return $this->hasone(parentuser::class); } return null; } if run: echo $user->details->staff_code; then outputs crs example. however, if run object_get() : object_get($user, 'details.staff_code'); then outputs null . i figured because in object_get() method, has line: if (! is_object($object) || ! isset($object->{$segment})) i assume because details property magic/dynamic laravel model property, isset() doesn't work on it. whats best way handle this? safe edit object_get() method , r

php - Internal Forward in Silex Without a Sending a 301/302 to the Browser -

i'm using silex's internal forwarding map public urls internal urls i.e. my.domain.com/something serves my.domain.com/something_else using $subrequest = request::create( $redirect, $method, [], // params $request->cookies->all(), $request->files->all(), $request->server->all() ); if ($request->getsession()) { $subrequest->setsession($request->getsession()); } return $app->handle($subrequest, httpkernelinterface::sub_request, true); however, in chrome's inspection tool, appears 301 resulting page, serves result. "by design" represents interesting security problem? there ways around limitation? while can't post code something_else route controller, gist is // controller provider $controller_factory->match('/something_else/{param}', function(...) { include 'path/to/some/file'; }); and // some/file - prepares file downloaded ... return new binaryfileresponse();

ios - Xcode storyboard: Internal error. Please file a bug -

Image
while editing in storyboard, assigning view controller specific class, encountered error when wanted run project. main.storyboard: internal error. please file bug @ bugreport.apple.com , attach "/var/folders/79/_jh611t15qsfcx165_jv_20h0000gn/t/ib-agent-diagnostics_2015-10-28_00-33-12_730000". and can't run project anymore. couldn't find information regarding anywhere else. did encounter before? i faced same issue. , solved cleaning build files. cmd + shift + k and cmd + option + shift + k hope helps thanks.

graphics - draw a line on c++ using qtcreator -

i extremely new on both c++ , qtcreator. @ school asked draw line between 2 crossed corner of image. planning use bresenhams algorithm calculate line don`t know graphics library. can tell me how put dot point calculated algorithm? your question vague. qtcreator gui qt development, there graphic library in qt should used purposes, anyway, should gain level in c++/qt (i.e. not "extremely new") utilize it.

ios - How to check how many times UIButton pressed in One Second -

i developing simple apple watch demo. in want check how many times uibutton pressing in 1 second. give me hint question. here code implemented: - (void)awakewithcontext:(id)context { [super awakewithcontext:context]; [btnbell setbackgroundimage:[uiimage imagenamed:@"bell.png"]]; [self performselector:@selector(checkcount) withobject:nil afterdelay:1.0]; nslog(@"%@ awakewithcontext", self); self.counter = 0; } - (void)willactivate { // method called when watch view controller visible user nslog(@"%@ activate", self); } - (void)diddeactivate { // method called when watch view controller no longer visible nslog(@"%@ did deactivate", self); } #pragma mark - button actions - (ibaction)savecounter { //send count parent application self.counter++; nsstring *counterstring = [nsstring stringwithformat:@"%d", self.counter]; nsdictionary *applicationdata = [[nsdictionary alloc] init

ios - addSubView - adding a button inside a UIView adds the same button for it's SuperView as well -

Image
i following tutorial create rating button - https://developer.apple.com/library/prerelease/ios/referencelibrary/gettingstarted/developiosappsswift/lesson5.html i created uiview inside uiviewcontroller inside storyboard drag , drop , uiview controlled below class. class ratingcontrol: uiview { required init(coder adecoder: nscoder) { super.init(coder: adecoder) let button = uibutton(frame: cgrect(x: 0, y: 0, width: 44, height: 44)) button.backgroundcolor = uicolor.redcolor() button.addtarget(self, action: "ratingbuttontapped:", forcontrolevents: .touchdown) addsubview(button) } override func intrinsiccontentsize() -> cgsize { return cgsize(width: 320, height: 44) } func ratingbuttontapped(button: uibutton) { print("button pressed 👍") } } the problem when add uibutton, it's showing 2 buttons, 1 in it's parent uiviewcontroller @ location (x:0, y:0) in addition 1 ins

php - Angularjs:Need help on two way binding(bipolar binding) -

when value change in back-end(in case mysql,patient details) other user(other console) ,i want update values on page @ same time(without refreshing page) .how possible. code given below. myscript.js var ajaxapp=angular.module('ajaxapp',[]); ajaxapp.controller('ajaxcontroller',function ajaxcontroller($scope,$http){ $http.get('core/getdata.php').success(function(data){ $scope.patient=data; }); }); my php page <tr ng-animate="'animate'" ng-repeat="p in patient|filter:pnametext|limitto:10"> <td><div class="btn btn-info">{{p.opno}}</div></td> <td><b><a href="getptdetails.php?pid={{p.pid}}">{{p.pname | uppercase}}</a></b></td> <td> <div ng-switch on="p.pcatid"> <div ng-switch-when="1"> 1

python - Django social and site-local token-based authorization -

i'm developing web service on django, , want make token-based registration feature (to make mobile-ready). after doing searching, found there's beautiful ready use applications: django-allauth , social authorization (facebook, twitter, google+, etc.) , site-local authorization (username/email/password), doesn't have built-in integration api , not token-based. python-social-auth or django-rest-framework-social-oauth2 , well-tested solutions, doesn't have site-local registration (social only) so, please give me links, or hints how implement this? i'm new django , python. in advance.

c - why this program using single pointer is not working -

if use double pointer instead of single pointer code working properly.. node *pairwiseswap(node *start) { node *prev=start,*current=start->next; if(start==null || start->next==null) return 0; while(true) { node *next=current->next; current->next=prev; if(next==null || next->next==null) { prev->next=next; break; } prev->next=next->next;**//next next** prev=next; current=prev->next;**//appending nodes previous one** } return start; } node *prev=start,*current=start->next; if(start==null || start->next==null) here's problem. if start==null error when doing current=start->next , since trying dereference null pointer i assume trying on linked list, , want return 0 (a null pointer) in case list has 1 element. if case, it's enough swap first 2 instructions of function

java - Exporting remote data and Socket Reuse in RMI -

i new rmi please forgive me if question silly. trying export data in concurrent manner. how can reuse same port exporting more 1 remote object @ once. can guide me achieve example? i tried first object got exported got following exception @ time of second export. java.rmi.server.exportexception: port in use: 55580; nested exception is: java.net.bindexception: address in use: jvm_bind i used following code snippet unicastremoteobject.exportobject(remoteobj, 55580); if skipped port number port number picked rmi. below unicastremoteobject.exportobject(remoteobj) in case port number fixed application. how can reuse same port exporting more 1 remote object @ once that's happens default. remote objects exported same jvm that don't specify port number, or specify port zero, and don't specify server or client socket factories, or specify same socket factories determined equals() will exported on same port. i conclude must exporting remot

html - Unvisited links looking wrong -

first post here, don't judge me if ask incredibly stupid, started working css couple of days ago. my problem (as can see here: www.silente.info ), when visited link looks different. , looks how want look, want unvisited link same way. i'm trying make unvisited link visited. i can't find can possibly screw up. registered , i'm calling help. :) edit: know tags do, 0.5 opacity whole block (when not being hovered) applies visited links. hope avoids answers telling me use stuff used in css provided. :) this css (yeah, it's mess). after can find html. /* test.css */ *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box} body{margin:0} table{border-collapse:collapse;border-spacing:0;width:100%;display:table} /* end of test.css ??*/ table,th,td,.playertable,.playerth,.playertd,.headertable,.headerth,.headertd { text-align: center; vertical-align: middle; table-layout: fixed; color: #603d9a; font: 16px/26.4px helvetica,san