Posts

Showing posts from April, 2015

jquery - EasyUI Treegrid - insert method does not update children collection -

i using jquery easyui treegrid on project. i have tree loaded initial data. afterwards, need insert new rows on tree when user clicks "add" button. add click handler has code , working expected: var row = $treegrid.treegrid('getselected'); if (row) { var obj = { id: "x" + ++maxid, code: "x" + maxid, amount: 2 }; $treegrid.treegrid('insert', { after: row.id, data: obj }); $("#txtresult").text("added new row: " + obj.id); } however afterwards when check children of row (where new child added), not include newly added row. i have setup jsfiddle demonstrate issue. reproduce it: select row @ 2nd level , click add child. new row added per code above. "row added" message displayed below buttons. select parent , click "show children" button. children count of selected row shown below buttons. after inserting row, ha

c++ - How to Make a Module Based Program With Intelligent Linking -

first off, clear confusion, 'module based program intelligent linking' mean having adapter class intelligently inherit individual header files through 'plug-n-play' type system. system needs consist of simple folder called example 'modules', , all user needs activate module drag , drop header , source file of module folder. believe need utilize scripting language generate required text, such #include s, in adapter file. not know dynamic link libraries, prefer use them if possible (they need produce same effect of course). for example, lets have main here: moduleadapter->initialize(); while (true) { moduleadapter->update(); moduleadapter->render(); } moduleadapter->release(); this loop should able pass update , render function calls all of linked modules. next, example empty module file called 'module0.h', have this: class module0 { public: void initialize(); void update(); void render(); void releas

php - Prepared Statement Inner Join Cannot Pass Parameter by Reference -

i've been trying figure out while , i've searched similar problems, can't find solution. i'm working on game setup application , i'm having issue prepared statement. if ($stmt = $connection->prepare("select pack.id, count(race.name) pack inner join race on pack.id = race.pack pack.id = ? group race.pack")) { $stmt->bind_param("s", $_session["id"]); $stmt->execute(); $stmt->bind_result($rsltid, rsltraces); while ($stmt->fetch()) { $racespack[$rsltid] = $rsltraces; } $stmt->close(); } this returns error: "fatal error: cannot pass parameter 2 reference". any help/advice appreciated! your $stmt->bind_result($rsltid, rsltraces); wrong. should $stmt->bind_result($rsltid, $rsltraces);

user interface - Qt- How to position UI elements like this? -

Image
i creating ui in qt has qdockwidget containing qpushbutton , qlineedit. please refer attached mock-up. have created widget components , got them , running. not positioned way want them to. both elements should float left making space right stretch when window resized. the code- this->searchfield = new qlineedit; //"this" qdockwidget subclassed object searchfield->setfixedwidth(200); mainmenu = new menu(); qhboxlayout *layout= new qhboxlayout; qspaceritem *filler = new qspaceritem(1000, 10); layout->addwidget(mainmenu->getmenubar()); layout->addwidget(this->searchfield); layout->addspaceritem(filler); any suggestion or awesome! time :) http://qt-project.org/doc/qt-4.8/layout.html http://qt-project.org/doc/qt-4.8/qboxlayout.html#addstretch void qboxlayout::addstretch ( int stretch = 0 ) adds stretchable space (a qspaceritem) 0 minimum size , stretch factor stretch end of box layout. so new code li

jquery - Snap Scroll in depth with JavaScript/CSS -

i need go deep scroll snap , help. i need achieve 3 effects: able draggable able scroll smoothly anchor able trigger simple animation changing color when content it's snapped you can use css / javascript / jquery / etc... achieve desired effects. here's snippet no results far: a, span { position: absolute } h1 { font-size: 40px; } .child { width: 400px; height: 400px; position: relative; background-color: #f0f0f0; display: inline-block; margin-right: -4px; border: 1px solid black; } .label { width: 200px; height: 200px; border-radius: 25%; background-color: white; margin: 100px auto 0 auto; } .label > h1 { font-size: 80px; padding-left: calc(50% - 22px);

Determine number of contacts with Google People API -

i using google people api fetch user's connections, , since results not include email addresses, phone numbers, etc. after call people.connections.list , retrieve total of 50 results polling people:batchget fetch data users (which accepts 50 users @ time). works fine, , after looping on results few times can import of contacts. great! but because of setup , need loop (some users have thousands of connections after all) using process (basically) redirects on , on until we're done. working fine, i'd love show progress bar on redirect screens, , in order i'd need know total number of connections user has. can't seem find way determine number of total results people.connections.list return (provided no filters or sync tokens passed in). know way can determine how many connections total need loop on people.connections.list? what language using? works me in java. // user's connections listconnectionsresponse r = peopleservice.people().connections()

forms - load from a txt to a list box in C# -

i have saving part down , know works, when click load button, not display have saved text boxes go saying.txt file using system; using system.io; using system.windows.forms; namespace windowsformsapplication2 { public partial class grades : form { private streamwriter fil; public grades() { initializecomponent(); } private void form1_load(object sender, eventargs e) { try { fil = new streamwriter("saying.txt"); //this txt file } catch (directorynotfoundexception exc) { lstbxdisplay.text = "nothing " + exc.message; } catch (system.io.ioexception exc) { lstbxdisplay.text = exc.message; } } // saving files saying.txt private void btnsaveas_click(object sender, eventargs e) { try { fil.writeline(txtbxlastname.text); txtbxlastname.text = "&q

git - Developing Between Multiple Computers -

i've been using git version control , github publishing code little while now. i'm getting comfortable interface , find helpful. however, i'm bit torn situation. i'm student using school computers , personal computer write code. i have work on application multiple computers. in middle of writing code when period ends , need leave. feels wrong push code github sync remote branch pc when home (this means that'd i'd have daily pushes github.) however, correct usage? if not, tool should use? want sync multiple workspaces code incorrect , buggy. it's ok push target work in progress branch. later on can ammend or squash history of branch before merging other main branches. take @ this: https://git-scm.com/book/es/v2/git-tools-rewriting-history

amazon web services - Number of lambda calls when called many nested calls are executed -

if call 1 lambda function 1 request, within function, there 3 calls made different functions count 4 calls or 1 call since based on 1 request? so if count 4 (from economic stand point) wouldnt better if 1 writes 1 long function instead of many small functions, despite being ill advised design pattern stand point? every invocation of lambda function counts. doesn't matter whether call console, cli, event source, or lambda function count invocation. personally, focus on writing lambda functions in way makes sense , allowed me use them effectively. if find costs factor later, can adjust then.

python - Web History/Connection Logger -

i'm thinking of writing application when running keeps track of websites visit , connections make. browser history, want in way utilizes network concepts. i have rudimentary understanding of http, able listen in on http requests browser , automatically pull information whenever request made? if can give me suggestion or outline of how can done, can research on implementing it, helpful! i'm thinking of implementing in python, , operating system ubuntu thank much. you implementing proxy . in case, basically, agent sits between browser , internet. proxy receive request client, then, send remote server, remote server may reply , you'll have send server response client. to retrieve informations wanting, reading http rfc helpful.

Does a nim library contain an argsort implementation or wrapper? -

i looking version of argsort , such as exists in numpy or in fortran there implementation of argsort in nim ... or accessible nim in library? seems bit surprising missing. update the following seems work argsort: proc argsort[t](a : t) : seq[int] = result = toseq(0..a.len - 1) sort(result, proc (i, j: int): int = cmp(a[i], a[j])) presumably, though, more efficient written natively , avoiding function pointer....

javascript - Meteor Routing Error : There is no route for the path: / -

i have updated meteor meteor 1.3.2.4. , facing issue. have updated packages in latest version. error : there no route path: / i tried both in both environment " meteor " , " meteor run --production " same error displayed in console. i have installed following packages. accounts-oauth 1.1.12 common code oauth-based login services accounts-password 1.1.8 password support accounts autopublish 1.0.7 (for prototyping only) publish entire database clients blaze-html-templates 1.0.4 compile html templates reactive ui meteor blaze cfs:gridfs 0.0.33 gridfs storage adapter collectionfs cfs:standard-packages 0.5.9 filesystem meteor, collectionfs ecmascript 0.4.3 compiler plugin supports es2015+ in .js files email 1.0.12 send email messages es5-shim 4.5.10 shims , polyfills improve ecmas

How to pass <select> option from page1 to page2 using JavaScript? -

i want pass page1.html selected value next page2.html page1.html : <form action="product.php" method="post"> <select name="option"> <option value="product">product</option> <option value="event">event</option> <option value="organization">organization</option> <option value="movie">movie</option> <option value="book">book</option> <option value="review">review</option> <option value="recipe">recipe</option> </select> <input type="submit" name="submit" value="go"/> </form> how can create var recieve selected option on page2.html using post method? thanks, ofer an elegant way of doing using localstorage have minor change in html & put snippet in js file html <form onsubmit = "s

Bootstrap 4 navbar, with dropdowns, and responsive template? -

for b3 there tonnes of templates of top navbar, drop down menus. screen size gets small, menu collapses 3-bar button, , menus become accordion menus. are there examples or templates using bootstrap 4? responsive examples have have found collapse menu, , show 3-bar button, menus don't become accordion menus. there many drop down examples bs4, not of them on responsive. do have hide whole navbar when screen gets small , reveal accordian same options? seems lot more work bs3. my solution add media query custom css targets screen size navigation collapsed, style elements way like: @media (max-width: 544px) { .navbar-brand { display:none; } .navbar-nav .nav-item { float:none; } .navbar-nav .nav-item + .nav-item{ margin-left:0; } } here's simple example on codepen . not sophisticated should illustrate point.

node.js - Create workflow for a "Global" bower_components folder for all of your projects? -

side note: i'm not looking "opinion-based" answers..i don't want thrown category. i'm looking proper method simplify workflow tools have available. problem i've been running lately: i'm installing multiple duplicate libraries (jquery + bootstrap example) on local disk on , on , on again when starting new projects... 1. create "new-client" folder 2. cd.. new-client 3. git clone my-starter-code 4. npm install (installing multiple dev dependency duplicates on disk) 5. bower install (installing multiple dependency duplicates on disk) 6. begin coding! this seems wasteful me if of these projects always have same base structure: same "node_modules" files (65.1 mb) same "bower_components" files (11.7 mb) same "../folders/files.html" structure (modular) what build tools can utilized create such workflow? package.json "scripts" ? yo generator ? gulpfile.js ? global node_modules + b

c++ - array iterator not dereferencable error -

there sample code occurs error bellows. in release mode, works , prints 5 '-'. however, in debug mode, doesn't work , occurs runtime error 'array iterator not dereferencable'. environment details : windows 7 64bit visual studio 2015 update 2 i don't know why there deferences between release , debug mode. in advance. #include <iostream> #include <array> static bool operator != (int * a, std::array<int, 5>::iterator &b) { return != &(*b); } int main(void) { std::array<int, 5> arr = { 0,0,0,0,0 }; (auto* = &arr[0]; != arr.end(); it++) { std::cout << "-" << std::endl; } return 0; } you call *b when b arr.end() . causes undefined behaviour . can use * on iterator refers element of array.

linux - How to store output of sudo -S su -c <user> <command> to any variable -

i trying execute following command output not coming required. var=$(echo "<password>"|sudo -s su -l <user> -c "<command>") please if can? expected result: var=$(echo ""|sudo -s su -l -c "pwd") echo $var /home/bhushan $: actual result: echo $var $: you can use backticks var=`sudo -s su -l -c ""` or $(command) syntax var=$(sudo -s su -l -c "") (keep in mind though sudo -s su -l -c "" doesn't output $var empty)

ios - Same View controller in Tab bar controller for 4 tabs is giving wrong selected tabcontroller selected index -

i trying make template app... lets app loads same view controller has collectionview 4 tabs. according selected index, have load contents collection view. setting tab bar manually appdelegate. question is possible instantiating same viewcntroller 4 tabs of tabbarcontroller @ time. if yes, how know correctly index selected? code tabbarcontroller in appdelegate self.window = uiwindow(frame: uiscreen.mainscreen().bounds) let tabbarcontroller = uitabbarcontroller() let storyboard : uistoryboard = uistoryboard(name: "main", bundle: nil) let firstimage = uiimage(named: "image1") let secondimage = uiimage(named: "image2") var controllers = [uiviewcontroller]() var = 0; < self.mylist.count; i++ { let vc : viewcontrollertwo = storyboard.instantiateviewcontrollerwithidentifier("view1") as! viewcontrollertwo

biztalk - Migration Approach for BT2006 R2 to BT2013 R2 -

currently working on migrating bt2006 r2 (vs2005) bt2013 r2 (vs2013). tried below twp approaches. approach i: first, open bt2006 r2 project in (vs2010)[bt2010] [intermediate] then upgrade bt2010 project bt2013 r2 (opening in vs2013 project). it's work fine. there no issue on that. approach ii: directly open bt2006r2 project solution file in vs2013 (without intermediate version) getting below error error migrating project user file. element biztalk beneath element visualstudioproject unrecognized. i tried remove project user file , migrate bt2013 r2. still same error occurred. so means, can't direct migration bt2006 r2 bt2013 r2? do need first approach above? put way, if direct upgrade not work, have use intermediate step. that's it. so, yes, must follow approach 1.

winforms - How to split every pages of a pdf into multiple pdf files in C# (using iTextSharp)? -

i trying convert every pages of pdf separate pdf files. have given range of 6 create 6 separate pdf files. using system; using itextsharp.text; using itextsharp.text.pdf; using system.windows.forms; using system.io; namespace learning.spitpdfapp { public partial class mainform : form { public mainform() { initializecomponent(); } private void splitpdfbutton_click(object sender, eventargs e) { mainform objmainform = new mainform(); objmainform.extractpage(sourcetextbox.text, destinationtextbox.text); } public void extractpage(string sourcepath, string outputpath) { int startpage = 1; pdfreader objreader = new pdfreader(sourcepath+".pdf"); int endpage = 6; document objdocument = new document(objreader.getpagesizewithrotation(startpage)); objdocument.open(); (int index = startpage; index <= endpage; index++) {

osx - Add your application to a Docker image -

i implementing docker container compile (build) code in c++. platforms supported code windows, linux , mac osx. i using clang on mac machine compile code; gcc on linux , microsoft compiler(cl) on windows. idea create docker container , perform builds(of both linux , mac) on windows machine (inside docker container) don't have push code git; pull mac machine , build , on. the image using perform mac build (since using clang on mac osx) https://hub.docker.com/r/rsmmr/clang/ . i want add executable image testing purpose. called 'testapp'. so image should have following components: base os + clang + testapp. how can add executable 'testapp' (say: application/utlity) image 'rsmmr/clang'(which pulled dockerhub) ? do via dockerfile (how?)? there other way accomplish same? one of simple way solve mounting source/binary testapp clang image. to demonstrate this, created testapp.cc myself , looked this: [anovil@ubuntu-anovil add_applicatio

signalr - Implementing Private chat with Windows Forms and asp.net signar -

i done winform client , web client , winform sever reffering following links. https://code.msdn.microsoft.com/windowsdesktop/using-signalr-in-winforms-f1ec847b but implemented in group chat want private chat. thankas in advance take on project. it's 1 one chat: http://www.codeproject.com/articles/562023/asp-net-signalr-chat-room the relevant function : public void sendprivatemessage(string touserid, string message) { string fromuserid = context.connectionid; var touser = connectedusers.firstordefault(x => x.connectionid == touserid) ; var fromuser = connectedusers.firstordefault(x => x.connectionid == fromuserid); if (touser != null && fromuser!=null) { // send clients.client(touserid).sendprivatemessage(fromuserid, fromuser.username, message); // send caller user clients.caller.sendprivatemessage(touserid, fromuser.username, message); } }

ruby on rails - Access columns from two different tables -

i using rails 4.2. have model user , comment class user has_many :comments end class comment belongs_to :user end user has column name , comment has column user_id , content want fetch columns comment.content , user.name using join can this comment.joins(:user).select(:name,:content) can suggest efficient method perform action? you can namespace columns following: comment.joins(:user).pluck('users.name', 'comments.content') # though, don't need `comments.content`; `content` work well.

linux - KSH password generator -

how make sure generated passwords contains these special characters (?!/=) ? currently i'm using: pwd_usr["$i"]=`cat /dev/urandom|tr -dc "a-za-z0-9-_\?\!\=\/\"|fold -w 15|head -n 1` but of generated passwords might not contain special characters want. please help. thanks. i suggest manually can check out yourself, so: i=0 while -lt 100 i=$(expr + 1) var=$(pwd_usr["$i"]=`cat /dev/urandom|tr -dc "a-za-z0-9-_\?\!\=\/\"|fold -w 15|head -n 1`) done echo $var so this, create 100 passwords, store them in var , output of echo can check if passwords contain want, , happy or keep on working :) p.s to make easier yourself, after output gets printed copy of editor , use search , control+f , know, , add characters want in order save lots of time.

itunesconnect - Invalid Swift Support - The SwiftSupport folder is missing -

i have updated submitted titanium app , added watch extension using swift. everything works fine if build , test on sim , build directly device. issue when submit app apple app store (via xcode organizer). the binary submits, passing validation email itunes connect follows: dear developer, we have discovered 1 or more issues recent delivery "xxxxxxxxxxx". process delivery, following issues must corrected: invalid swift support - swiftsupport folder missing. rebuild app using current public (gm) version of xcode , resubmit it. once these issues have been corrected, can redeliver corrected binary. it seems though may related build setting: embedded content contains swift code . it looks needs set yes if titanium project contains embedded swift. as of stuck cannot submit app. ti problem or there step should follow? xcode: 7.3, sdk: 5.2.2.ga - project created , built using ti cli. for future reference: had archive titanium project

Android. Fit webview size to youtube video size -

i'd play youtube video using android webview. but want fit webview youtube video size. until now, implementaion below. string vid = textutils.extractyoutubevid(body); if (stringutils.isblank(vid)) { return null; } string html = "<html > <head></head> <body style=\"margin:0 0 0 0; padding:0 0 0 0;\"> <iframe width=\"100%\" height=\"100%\" src=\"http://www.youtube.com/embed/___\" frameborder=\"0\"></iframe> </body> </html> "; html = html.replace("___", vid); mimportedvideowebview.setwebchromeclient(new webchromeclient()); websettings websettings = mimportedvideowebview.getsettings(); websettings.setjavascriptenabled(true); mimportedvideowebview.loaddata(html, "text/html", "utf-8"); mimportedvideowebview webview , width match_parent , height 350dp. by us

ios - Retrieving a child returns null snapshot -

i have 2 child nodes setup in firebase database , can view both of these in firebase database viewer. both these child nodes @ root level. when access child nodes using piece of code: [ref observeeventtype:feventtypevalue withblock:^(fdatasnapshot *snapshot) {...} the child labelled "usd2016d04d24" returns correct json data. however, when access child labelled "usd2016d04d25", snapshot returned null. can see this screenshot , there valid data saved within latter node. can't figure out why there discrepancy in reading data 2 similar nodes. pointers?

r - How to extrapolate beyond the x points passed to `ksmooth`? -

i have kernel function so: x <- 1:100 y <- rnorm(100, mean=(x/2000)^2) plot(x,y) kernel <- ksmooth(x,y, kernel="normal", bandwidth=10) print(kernel$y) if try predict @ point outside of range of x values, give me nan , because attempting extrapolate beyond data: x <- 1:100 y <- rnorm(100, mean=(x/2000)^2) plot(x,y) kernel <- ksmooth(x,y, kernel="normal", bandwidth=10, x.points=c(130)) print(kernel$y) > print(kernel$y) [1] na even when change range.x doesn't budge: x <- 1:100 y <- rnorm(100, mean=(x/2000)^2) plot(x,y) kernel <- ksmooth(x,y, kernel="normal", bandwidth=10, range.x=c(1,200) , x.points=c(130)) print(kernel$y) > print(kernel$y) [1] na how ksmooth function extrapolate beyond data? know bad idea in theory, in practice issue comes time. to answer side question, looking @ code of ksmooth , range.x used when x.points not provided explains why not see used. let's @ code in ksmoot

c# - Compiling a Syntax Tree using Roslyn -

i'm trying use roslyn generate , compile runtime library of simple objects containing get/set properties. however, reason, compiling assembly fails error of adding linq namespace (error cs0246: type or namespace name 'system.linq' not found (are missing using directive or assembly reference?)}). i've tried manipulating generated tree in number of ways , compiling each, still compilation fails. the way in compilation succeeds if tree parsed string, parsed syntax tree , compiled. the code below following: build simple syntax tree containing compilation unit, usings, namespace, class , property. try compile tree (fails) generate new syntax tree c#6 option , compile (fails) format syntax tree , compile (fails) serialize tree string, use syntaxfactory.parsesyntaxtree , compile generated tree (success) the code: private static readonly csharpcompilationoptions defaultcompilationoptions = new csharpcompilationoptions(outputkind.dynamicallyli

How to make a query with dynamic column in sql server 2012 -

i have sample code below. result such takes these columns varchar type. declare @col1 varchar(80)='[column1]' declare @col2 varchar(80)='[column2]' select @col1,@col2 mytable you have use dynamic sql: declare @col1 varchar(80) = 'column1'; declare @col2 varchar(80) = 'column2'; declare @sql nvarchar(max); select @sql = 'select ' + quotename(@col1) + ', ' + quotename(@col2) + ' mytable;'; exec sp_executesql @sql; note have make sure column names real column names. need parameterize query added security. if of these wrong, may create huge security problems.

c# - Sending the mail via Exchange service -

am trying send mail via exchange server without opening outlook, have used code below. following below code send mail directly exchange service, receiving error autodiscovery url can please me out here. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using microsoft.exchange.webservices.data; namespace serivcemessgae { class program { static void main(string[] args) { exchangeservice service = new exchangeservice(exchangeversion.exchange2013_sp1); service.credentials = new webcredentials("karan.kotabagi@***.com", "***"); service.traceenabled = true; service.traceflags = traceflags.all; service.autodiscoverurl("karan.kotabagi@***.com", redirectionurlvalidationcallback); emailmessage email = new emailmessage(service); email.torecipients.add("karan.kotabagi@***.com"

python - How to select two or more elements from the same node with Xpath? -

i select 2 elements same node. here code: <div > <span >first element select:</span> <span ></span> <strong >second element select</strong> </div> i have tried this: $x('//div/span/text()') and array this: ["first element", " "] is there anyway get: ["first element", "second element"] and perhaps put python dictionary? , have: dict = {'first element' : 'second element'} many helping you can use following xpath : //*[@id="details"]//div/*/text() or if want text nodes span , strong : //*[@id="details"]//div/*[self::span|self::strong]/text() to skip empty text nodes, add predicate [normalize-space()] : //*[@id="details"]//div/*/text()[normalize-space()]

mysql - Error in SQL query (SQL update) -

the query : update t1 set t1.paper_attempt = 1 table1 t1 join table2 t2 on t2.user_id = t1.user_id join table3 t3 on t3.id = t2.company_id t3.candidate_id = 'cand024'; i using heidisql, on running query, showing syntax error. please help! your syntax doesn't work in mysql. the common multi-table update query is: update [low_priority] [ignore] table_list set col_name1={expr1|default} [, col_name2={expr2|default}] ... [where where_condition] i.e. query should rewritten as: update table1 t1, table2 t2, table3 t3 set t1.paper_attempt = 1 t2.user_id = t1.user_id , t3.id = t2.company_id , t3.candidate_id = 'cand024'; also can use subquery: update table1 t1 set t1.paper_attempt = 1 t1.user_id in ( select t2.user_id table2 t2 join table3 t3 on (t3.id = t2.company_id) t3.candidate_id = 'cand024' );

dojo - How to make layout for dgrid with dijit/Toolbar? -

i place dgrid table widget, grid overlapped toolbar. how fix broken layout? here current layout custom widget: <div data-dojo-type="desktop/users/userswidget"> <div data-dojo-type="dijit/layout/layoutcontainer"> <div data-dojo-type="dijit/toolbar" data-dojo-props="region: 'top'"> <!-- here buttons, separators, etc --> </div> <div data-dojo-type="desktop/grids/usersgrid" data-dojo-props="region: 'center'"></div> </div> </div> also, css: html, body, .layout-container { margin: 0; padding: 0; width: 100%; height: 100%; } index.html <body class="claro"> <div data-dojo-type="dijit/layout/layoutcontainer" class="layout-container" id="layoutcontainer"> <div data-dojo-type="desktop/menus/mainmenu" data-dojo-props="

function - Is i possible to call t() instead of I18n.t() in javascript? -

i using i18n-js load locales in js app. when use translate function in view able t('hello') instead of i18n.t('hello') . how can such alias work? import i18n 'i18n'; const hello = () => { return ( <div>{i18n.t("hello", {name: "john"})}</div> ) } you could assign t function window : window.t = i18n.t; then can use t('hello') . however, @ thilo mentioned , may result in complications. a better alternative write small wrapper: function t(key){ return i18n.t(key); } the best option, suggested @ deceze , single line: var t = i18n.t.bind(i18n); single-line, , should work regardless of scope it's called in.

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

my cursor : select xzis.msisdn msisdn, xzis.in_account_number in_account_number xxobw_zte_in_sync xzis not exists (select 1 hz_contact_points hcp, hz_cust_accounts hca hcp.owner_table_id = hca.party_id , hcp.owner_table_name = 'hz_parties' , hcp.phone_number = substr (xzis.msisdn, -8) , nvl (hca.attribute12, 'nil') = xzis.in_account_number); i have given alias columns, still facing issue. suggestions? it's cursor. 1 has no such problems. problem is, when you're joining 2 tables, or apply wrong aliases in subselect, cursor may @ end return 2 columns same name/alias. the problem not need alias, no 2 columns can have same alias (the name counting alias, when no alias given). apparently has happened, far can tell, it's

mobile - like facebook page from another appliction -

is possible facebook (and check-in) business page mobile application? (this application using facebook log-in) thanks. gil. facebook has provided ways it. check link: check this

i am trying to execute a r script from asp.net page using c# but it's not executing -

i have used rscript runner not working. public static string setuppath(string rversion = "r-3.2.3") { var oldpath = system.environment.getenvironmentvariable("path"); var rpath = system.environment.is64bitprocess ? string.format(@"c:\program files\r\r-3.2.3\bin\x64", rversion) : string.format(@"c:\program files\r\r-3.2.3\bin\i386", rversion); if (!directory.exists(rpath)) throw new directorynotfoundexception( string.format(" r.dll not found in : {0}", rpath)); var newpath = string.format("{0}{1}{2}", rpath, system.io.path.pathseparator, oldpath); system.environment.setenvironmentvariable("path", newpath); return newpath.tostring() ; } this button1_click method calls rscript runner. protected void button1_click(obje

scala - change data type sequence String to String -

my dal : def login(username: string,pass :string) = sql"""select ad1sys.pkg_stc_login.user_login ('#$username','#$pass')from dual""".as[string] def getempname(username: string,empname :string) = sql"""select ad1sys.pkg_stc_login.get_empl_name ('#$username','#$empname') dual""".as[(string)] my service : def login(username:string,pass:string): future[seq[(string)]] = { db.run(dallogin.login(username, pass)) } def getempname(username:string,empname:string): future[seq[(string)]] = { db.run(dallogin.getempname(username, empname)) } my controller : def login = action.async(bodyparsers.parse.json) { request => val username = (request.body \ "username").as[string] val pass = (request.body \ "pass").as[string] servicelogin.login(username, pass).map { data => servicelogin.getempname(username,data).map(result

Problems with Jquery and Javascript SDK of Parse on Safari -

i'm new jquery , parse , don't speak english first of sorry syntax of question. wrote function update artist object on parse.com (updateartist(objectid)). function called when click on save button , works fine on firefox , chrome not on safari. function updateartist(objectid) { parse.initialize("myid", "myid"); alert(objectid); var artist = parse.object.extend("artist"); var query = new parse.query(artist); query.equalto("objectid", objectid); query.first({ success: function(object) { // retrieved object. $('#createartist').css('visibility', 'hidden'); $('.loadingimage').css('visibility', 'visible'); alert('success'); var name = $("#txtname").val(); var link = $("#txtlink").val(); var desc = $("#txtdesc").val(); var place = $("#txtplace").val(); var latitude = p

Retrieving the property name as a string jSon jQuery -

var days = new array("sun", "mon", "tue", "wed", "thu", "fri", "sat"); $.each(data, function (i, object) { $.each(object, function (property, value) { var propertystring = getpropertyasstring(property); if ($.inarray(propertystring, days) != -1) { // } count++; }); }); above code stub i'm using retrieve data json using jquery. want " property name" (i've marked using getpropertyasstring() inside nested $.each() string want check if "property name" exists in days array or not. to more specific, below json: [{ "stid": 0, "vrno": 0, "vrnoa": 0, "vrdate": "\/date(-62135596800000)\/", "party_id": null, "bilty_no": null, "bilty_date": "\/date(-62135596800000)\/&quo

c# - Read Image as base64 string; Out of memory exception -

i'm trying convert images in directory base64 strings. when test in local computer works, on server gives out of memory exception: here method: private imagedataviewmodel readimagesfromdisk(guid id) { list<string> imagelist = new list<string>(); imagedataviewmodel imagedataviewmodel = new imagedataviewmodel(); string path = httpcontext.current.server.mappath("~/businessimages/" + id.tostring()); try { if (directory.exists(path)) { var images = directory.getfiles(path, "*.*", searchoption.alldirectories) .tolist(); string filename = id.tostring(); foreach (var item in images) { using (image image = image.fromfile(item)) { using (memorystream m = new memorystream()) { image.save(

assembly - What exactly is bytecode? -

is byte code intermediate form of code between assembly code , machine code? , bytecode same object code? this think - high level language->assembly language->machine code/object code (0s , 1s. different different cpus) is this? high level language->assembly language-> byte code(will taken care of virtual machine, convert machine code) -> machine code i've read - so- bytecode vs assembly language code , need understand better bytecode nothing more instruction set vm. implementation of may or may not involve jit machine code. often, not. official lua implementation, example, interprets bytecode rather converting machine code. .net , java implementations compile "hot paths" machine code more efficient execution. ultimately, vm implementation detail , has nothing bytecode itself, instructions vm. object code, afaik, machine code.

git - Docker build failed because of "port 443: Connection timed out" -

$ docker build buehler/twitterbeat sending build context docker daemon 96.26 kb step 1 : golang:1.5.2 ---> 9c67771abd78 step 2 : maintainer christoph buehler <christoph.buehler@bluewin.ch> ---> using cache ---> 57cbdd07c195 step 3 : env go15vendorexperiment 1 ---> using cache ---> fd69aeb2425d step 4 : run git clone https://github.com/masterminds/glide.git $gopath/src/github.com/masterminds/glide && cd $gopath/src/github.com/masterminds/glide && make bootstrap && make build && cp ./glide /usr/bin ---> running in 025c97c1cba1 cloning '/go/src/github.com/masterminds/glide'... fatal: unable access 'https://github.com/masterminds/glide.git/': failed connect github.com port 443: connection timed out command '/bin/sh -c git clone https://github.com/masterminds/glide.git $gopath/src/github.com/masterminds/glide && cd $gopath/src/github.com/masterminds/glide && make boo

mongodb - Creating fields based on what's returned, meteor pub/sub -

probably bad title, don't know how precisely describe this. template.body.helpers({ messages: function () { return messages.find({}, { sort: {createdat: -1} }); } }); this code have. on client side, takes {{#each messages}} <span class="text"> {{messagetext}} </span> {{/each}} each message contains "text" , "username". how go about, in "return messages" part, modifying returns? so like template.body.helpers({ messages: function () { messages.find().foreach(function(thismsg){ messagetext = slugify(thismsg.messagetext) }; } }); get messages, modify fields , return them. perhaps in subscriptions instead? please help. you can pass message in helper , can modify message , pass template this. your template code. {{#each messages}} <span class="text"> {{slugifymessage text}} </span> {{/each}} you helper code.

c# - What encoding does Mono use when marshalling strings in P/Invoke? -

i'm reading mono's marshalling guide , purpose of marshalling strings between objective-c++ , unity (for ios games), , i'm confused string marshalling encodings in mono. i understand string encodings marshalling specified charset enum, allows ansi , unicode (=utf-16) (and auto, makes runtime choose between first two). but guide keeps saying mono marshals strings in utf-8. how possible? magic happens if no charset specified? mean can safely pass -[nsstring utf8string] objective-c++ c#, if don't specify charset? , imply incompatibility microsoft's runtime? the ansi charset value meaningless on non-windows operating systems, in case utf-8 used, case ios. this incompatibility ms runtime, bigger incompatibility in case ms runtime doesn't run @ on ios:).

android - Notification when a specific color from a pixel is selected -

i want create program this: take picture; select area color; the app inform user current shade of white , select shade based on options receive app what i'm trying message see if selected color (from touched position) closer shade of white i'm implementing (let's say, if touched color between #fcffffff , #fcfef9d5 program display "a2"). this code far: public class mainactivity extends activity { textview touchedxy, invertedxy, imgsize, colorrgb; imageview imgsource1; button b, bopenfromgallery; static final int camrequest = 1; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); touchedxy = (textview) findviewbyid(r.id.xy); invertedxy = (textview) findviewbyid(r.id.invertedxy); imgsize = (textview) findviewbyid(r.id.size); colorrgb = (textview) findviewbyid(r.id.colorrgb); b = (button)findviewbyid(r.id.button01); bopenfromgallery =

java - How can I enable left click drag or right click in swt.browser -

Image
i trying embed web browser inside java application. unfortunately has in application , not open browser. i have found org.eclipse.swt.browser . using browser display 3d models , when click in browser , drag mouse should able rotate it. there option enable or can fix this? you can use site example: https://a360.autodesk.com/viewer when open site there models can rotated left click or moved right click. but when open same page using swt.browser can't neither rotate or drag model. import org.eclipse.swt.swt; import org.eclipse.swt.browser.browser; import org.eclipse.swt.widgets.display; import org.eclipse.swt.widgets.shell; public class browserclass { public static void main(string[] args) { display display = new display(); final shell shell = new shell(display); shell.settext("browser example"); shell.setsize(1300, 800); final browser browser = new browser(shell, swt.none); browser.setbounds(5, 5, 1275, 750); shell.open();

Excel 2013 converts text to dates in csv comma separated file -

i editing csv comma separated file in excel 2013. when enter 6/60 in column, excel turns jun-60 , don't want that. i've tried: choosing "text" in "cell format" options. save changes , close program. when open file have: jun-60 pasting values. save changes , close program. when open file have: jun-60 entering '6/60. save changes , close program. when open file have: jun-60 entering "=""6/60""". save changes , close program. when open file have: "=""6/60""" i had combined options. not working. any ideas? please remember editing csv comma separated file in excel 2013 not xlsx format. thanks! how this: use own option 1. not re-open file file menu, import data (data-tab, text). on last page of wizzard, choose 'text' column data format. should work.

php - CakePHP not binding model automatically -

cakephp 2.8.3 not binding model automatically. model : <?php class item extends appmodel { public $name = 'item'; public $belongsto = array( 'cat' => array( 'classname' => 'cat', 'foreignkey' => 'cat_id', ), ); } the above model not working. however when bind model in controller. works fine. $this->item->bindmodel(array( 'belongsto' => array( 'cat' => array( 'foreignkey' => 'cat_id', )))); what cause ?

javascript - hide button in a row on certain value of a column -

i have autogenerated table tasks , status. each row has button restart task. i want hide restart button if the value of task isn't equal "error". in other words: tasks status==error should have visible restart button here fiddle link: https://jsfiddle.net/hwqt7c3a/5/ i have tried: window.onload = function () { $(function () { $('table tr').each(function () { var cells = this.getelementsbytagname("td"); if (cells[2].innertext !== 'error') { $(this).find('button').style.visibility = 'hidden'; } }); }); } but reason cells empty. i have updated fiddle , here working fiddle $(function() { //document ready event $('table tr').each(function() { //loop tr's var cell = $(this).find('td:eq(2)'); //find 3r

asynchronous - Sorting an async relationship -

i have ember app shows 'competitions' , each 'competition' object has many 'competitor' objects: app/models/competition.js import ds "ember-data"; export default ds.model.extend({ name: ds.attr('string'), competitors: ds.hasmany('competitor', {async: true}), }); i have league-table component passed 'competition' object main data. app/components/league-table.js import ember "ember"; export default ember.component.extend({ classnames: ['league-table'], competition: null, visiblecompetitors: ember.computed.filterby('competition.competitors', 'hidden', false), sortproperties: ['score:desc'], sortedcompetitors: ember.computed.sort('visiblecompetitors', 'sortproperties'), }); i present competitors in correct order simple list. sort order determined complicated ' score ' property of competitor calculated based on significant amount of

Get user information from active directory asp.net webforms c# -

i got webforms hosted iis you can log in webform site using active directory username , password how other information of user first , last name active directory current code in page load after success log in. protected void page_load(object sender, eventargs e) { formsidentity id = (formsidentity)user.identity; formsauthenticationticket ticket = id.ticket; response.write("<p/>ticketname: " + ticket.name); //this ticket.name current username logged form response.write("<br/>cookie path: " + ticket.cookiepath); response.write("<br/>ticket expiration: " + ticket.expiration.tostring()); response.write("<br/>expired: " + ticket.expired.tostring()); response.write("<br/>persistent: " + ticket.ispersistent.tostring()); response.write("<br/>issuedate: " + ticket.issuedate.tostring()); re

swift - How do I implement this protocol in struct -

i'm new swift , want create abstract factory db access. here protocol protocol idaofactory { associatedtype dao: idao func createaccountdao<dao: iaccountdao>() -> dao } struct realmfactory: idaofactory { } protocol idao { associatedtype t func save(object: t) } protocol iaccountdao : idao { } struct accountdaorealm: iaccountdao { } how implement idaofactory in struct realmfactory , iaccountdao in struct accountdaorealm? can help? generics in swift have many restrictions when used in protocols , implemented in struct. let's wait until swift 3 :) i use protocols , derived classes or generics classes mixing protocols generics , structs makes headache in swift 2 (c# generics in more convenient) i played code in playground, here is protocol idaofactory { associatedtype dao: idao func createaccountdao<dao: iaccountdao>() -> dao } protocol idao { init() associatedtype t func save(object: t) } protocol ia

ios - Swift: CoreData and generic NSOrderedSet -

i'm not sure if did not found information or if it's not possible. i've looked several pages. want use generic generic version of nsorderedset in swift. with set can this: swift’s set type bridged foundation’s nsset class. source: apple docs - sets in nsmanagedobject subclass can change nsset set , work. (tested it) @property nsarray<nsdate *> *dates; @property nsset<nsstring *> *words; @property nsdictionary<nsurl *, nsdata *> *cacheddata; var dates: [nsdate] var words: set<string> var cacheddata: [nsurl: nsdata] source: apple docs - lightweight generics but couldn't find reference ordered set in swift. use nsorderedset objective-c won't have generics in swift then. is there possibility define order in set in swift? no, there no ordered set in swift , in honesty, shouldn't using ordered set period. of use. but times, useful. don't have sort data yourself. when have entity list of sub entiti

c++ - Image Warping. From one image to another -

i'm using word "warping" because word explain want do, i'm not sure suitable term... what want achieve find operation modify image image. i'll explain myself : have 2 images similar (the same scene, same moment not same point of view), want know how transform image1 image2, transformations have do. so, thinking : if want transform i1 i2 : convert i1 , i2 b&w pictures. apply sobel filter. create patches both images (little image part of big images). 15px*15px patches. find differences between i1.patch(x,y) , i2.patch(x,y) , find transformation transform i1.patch(x,y) i2.patch(x,y). for patches, apply transformation on coloured image. do think it's idea that? know method better? and if think it's idea, have idea point number 4 above? because have idea, think i'm little naive think it'll work: use 2 matrices , find path transform 1 least possible operations or use standard warping algorithm. i'm use opencv3.0 on wind