Posts

Showing posts from July, 2012

access vba - Modifying records sourced in a joined query -

i cannot update records on form it's record source in simple sql select query (containing 2 joined tables linked combo box value). have ensured properties of each field , form set editing unfortunately when go fields, although lets me enter, cannot make changes. possible case because records sourced query ? below routine queries data , maps record source form triggered 'after update' event on combo box used filter records. data table trying update ' tblvaluechain02 ' , extracted string sql_get2 , fed form frmstaticdatadepartments06 . private sub cboteams_afterupdate() dim sql_get string dim sql_get2 string sql_get = "select * tblvaluechain01 tblvaluechain01.macroprocess = '" & cboteams & "'" sql_get2 = "select tblvaluechain01.macroprocess, tblvaluechain02.autonumbering, tblvaluechain02.microprocesso02, tblvaluechain02.notes, tblvaluechain02.remarks tblvaluechain02 inner join tblvaluechain01 on tblv

php - Post Two Forms From Same Webpage In Laravel -

i creating 1 page website using laravel have login form , registration form on same page. i wish route them respective controller functions, say, accesscontroller@login , accesscontroller@register respectively. how can achieve this, when both forms route be: route::post('/', 'controllername@function') it's bad idea, can achieve want doing this: add <input type="hidden" name="action" value="register"> , <input type="hidden" name="action" value="login"> signup , login forms accordingly in controller method check form submitted: $action = input::get('action'); // handle register request if ($action === 'register') { return $this->register(); // handle login request } elseif ($action === 'login') { return $this->login(); } else { throw new exception("unknown action"); }

mongodb - Rails Mongoid fails to authenticate - failed with error 13: "not authorized for query on my_db.my_collection" -

this issue said resolved latest version of moped still happens me. have rails 4.2 app mongoid , created user mongodb db readwrite , dbowner roles, , set auth=true in mong.conf file. can perform actions on db user credentials using mongo shell or simple java application using mongo driver. however, when trying authenticate mongoid always error: failed error 13: "not authorized query on my_db.my_collection" here relevant portion of mongoid.yml file: production: # configure available database sessions. (required) sessions: # defines default session. (required) default: # defines name of default database mongoid can connect to. # (required). database: my_db hosts: - localhost:27017 username: my_username password: my_password i've tried replacing host remote address of server , access remotely ( works authentication option disabled ) without success. what's worth, can see credentials debu

angularjs - need good design for dynamic templating and transclusion, or ng route for Quiz application -

i new angularjs , little confused approach need take project. can 1 provide me pointers? my requirements are: using angular ui-layout. on right end split area part having 100 buttons, when click 1 of these buttons, should able display particular type of question in middle split area. questions can of different type multiple choice, fill in blank, etc. in middle split area whatever may question multi choice or fill in blank, etc need have few common buttons save, next, clear answer, etc. these butons functionality common types of questions. when click 1 of buttons (out 100 in right split area) should display different type of question specific button in middle split area. have gone through articles directives, template, template url, dynamic templates, transclusion, etc. thinking whether ng routing of better option here instead of going custom directives? these confusing me, can 1 me me stat project design?

sql - ORA-01843 Not a valid month -

i have seen of topics error can't seem understand people mean. codes: create table vehicle ( v_id char (10) not null, v_model varchar2 (20) not null, v_manufacterer varchar2 (20) not null, plate_number char (10) not null, arive_date date not null, pickup_date date not null ); this table , got dropped/created want insert these values in column keeps giving me error, looked @ other solutions bit different mine. might simple but, i'm new sql. insert vehicle (v_id, v_model, v_manufacterer, plate_number, arive_date, pickup_date) values ('v100','bmw','430i','n-55530','01-02-2015','02-02-2015'); insert vehicle (v_id, v_model, v_manufacterer, plate_number. arive_date, pickup_date) values ('v102','lexus','ls300','m-33833','11/05/2015','12/05/2015'); insert vehicle (v_id, v_model, v_manufacterer, plate_number, arive_date, pickup_date) values ('v101',' mercedes','

How to find all the JavaScript globals in browser code which are not part of the DOM, host objects, etc? -

this question has answer here: get user defined window properties? 3 answers in javascript in browser global variables stored members of window host object. but in window properties of window part of browser dom and, if assume correctly, other global functions , objects host objects or otherwise part of implementaton / environment provided browser. how can iterate through members of window , filter out as possible not regular global variable created code such var foo = 1; ? why don't try: keys(window); the object.keys() method returns array of given object's own enumerable properties, in same order provided for...in loop (the difference being for-in loop enumerates properties in prototype chain well). reference: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/keys

functional programming - Example of a matrix as Applicative functor -

i asked similar question not clear enough, decided rephrase it. i know matrix applicative functor not monad. wondering if there simple , practical example of <*> matrices. a possible applicative instance matrices make analogous ziplist . f matrix of functions, , x matrix of values, f <*> x applies each function in f pointwise each value in x . result truncated in each dimension fit shortest matrix. pure f gives infinite matrix f @ each point. example example, pointwise matrix multiplication (*) <$> <*> b . in stead of truncation , working infinity, fix shape of matrix using phantom type parameter used in accelerate . of course, declare monad instance fixed size ziplists.

ruby - Cucumber: How to run the After hook only once after all examples in scenarion_outline -

i have scenario_outline tests login screen of website. scenario_outline: try login verify login examples: | user | pass | | user1 | pass1 | | user2 | pass2 | i want able start web page @ beginning , close if after examples done. running before hook easy before $start ||= false if ! start #start web page $start = true end end but how run after hook once after scenarios done? after #close web page end the above example closes web page after first example , causes rest fail. cannot apply here did before hook unfortunately the reason rest of tests failing because after method not setting global false: after #close web page $start = false end i don't believe there afterscenario hook. in situation, if want browser open entire scenario outline, consider using regular scenario , cucumber table. share browser session across each test case. fyi: there at_exit hook. it's purpose running

Getting PlaylistItems by Page Number in YouTube API? -

okay, lets have youtube playlist 500 items in them. youtube's playlistitems end-point allows retrieve 50 items @ time: https://developers.google.com/youtube/v3/docs/playlistitems/list after 50 items, gives nextpagetoken can use specify in query next page. doing this, iterate through entire playlist 500 items in 10 queries. however, if wanted last page? page 10? in youtube's v2 api, have told start index @ position 451, , give results 451-500. doesn't seem option in v3 api. now, seems if wanted page 10, have iterate through entire playlist once again, throw out first 9 pages, , take 10th page. this seems huge waste of resources , curl operations alone killer. so possible set starting index in v3 api in v2 api? you can still use start index have generate corresponding page token yourself. as far can tell observation, page tokens byte sequence encoded in base64, first byte being 8 , , last 2 being 16, 0 . generate tokens (using python 3): i = 451

php - How to get last first and last from table with same date (query)? -

Image
i want ask query, want make last insert item system. if people insert new item, insert date , time track table and then, want first , last rows of day per date: what query data? a simple group by clause should trick: select employee_id, `date`, min(insert_data_time) first_time, max(insert_data_time) last_time track group employee_id, `date`

embedded - sdcc Makefile for 8051 microcontrollers -

hey there works sdcc make projects 8051 microcontroller series on macbook. if yes can please post working make file, specially part loads program in device. confused write program tag in makefile. it not case makefile include loading code part, old example not help. makefiles simple in essence; have target, , dependencies - if target not exist, or dependency newer target, target rebuilt executing commands. in case need phony target (one never exists), dependent on binary image or hex-file (or whatever format load file is), the command execute launch whatever flash-programming or bootloader tool toolchain uses load image: .phony loadimage loadimage : myprogram.hex loader.exe myprogram.hex

verilog - Multiplying two 32 bit numbers using 32 bit carry look ahead adder -

i have tried write code in verilog multiply 2 32 bit binary numbers using 32 bit carry ahead adder program fails compile. the generate if condition must constant expression error keeps on coming in modelsim part 'if(store[0]==1)' , 'if(c[32]==1)' this algorithm followed: begin program multiplier = 32 bits multiplicand = 32 bits register = 64 bits put multiplier in least significant half , clear significant half = 1 32 begin loop if least significant bit of 64-bit register contains binary ‘1’ begin if add multiplicand significant half using claa begin adder c[0 ] = ’0’ j = 0 31 begin loop calculate propagate p[j] = multiplicand[j]^ significant half[j] calculate generate g[j] = multiplicand[j]·most significant half[j] calculate carries c[i + 1] = g[i] + p[i] · c[i] calculate sum s[i] = p[i] Å c[i] end loop end adder shift 64-bit register 1 bit right throwing away least significant bit else shift 64-bit register 1 bit right throwing away least significant bit en

What is good practice to load data in Angularjs? -

i have 2 kinds of information: my messages messages me i can 1 ajax request in angular types of messages, approximately 2000+ notes. filter ng-repeat . but there lot of messages. break page , use lot of resources? if yes, can load data separated click. practice load data on page in angular js? you should load data using ng-repeat don't load 2000 records, may cause performance issue while rendering dom. believe should use pagination on records use paginate library example plunkr

ruby on rails - Displaying all Articles Created by a User Devise -

using devise on rails 4 app. i users able view articles they've created, inside of devise edit registration page. i have tried lots of different things in order work, cannot. awesome. here code far: registrations_controller.rb (had manually create inside of controllers/users): class users::registrationscontroller < devise::registrationscontroller def articles @user = user.find(params[:id]) @articles = @user.articles end end routes.rb: devise_for :users, controllers: { registrations: "users/registrations" } user.rb: has_many :articles article.rb: belongs_to :user edit.html.erb (inside of views/devise/registrations): <% @articles.each |article| %> <%= article.inspect %> <% end %> still new rails on might doing wrong and/or best way go great. let me know if need other of code. i think forgot add ) @ last. see this, @user = user.find(params[:id])

android - onPostExecute() isn't getting invoked when the AsyncTask is executed from a nested event listener -

here's trying do: fetch json array remote server , render in list view (in new activity) when item selected list of items in popup. popup created when element in activity clicked/tapped. more specific: activity displays list of categories in grid view. each category has bunch of subcategories shown list of items in popup when user clicks on category. when user selects 1 of items in popup new activity created displays list of items in subcategory. item details fetched remote server json array. have created asynctask fetch item details server when sub-category selected popup. following code snippet this. public class section extends fragment { ... @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { ... mgrid.setonitemclicklistener(new adapterview.onitemclicklistener() { public void onitemclick(adapterview <? > parent, final view v, nt position, long id) { ..

oop - PHP get current class name in inherited class -

i have code in php: abstract class development { static function testunit() { echo get_class(); } } class component extends development { } but if calling component::testunit(); i receiving development instead of component. puzzling me because such static function has no meaning guess. you want use get_called_class instead ... http://php.net/manual/en/function.get-called-class.php

javascript - How to get value of checked checkbox (in footer of jqgrid) and send to controller? -

Image
i have checkbox in footer of jqgrid , want send value of checkbox controller when click on button(send command). when row selected , click button send command, in addition value, check box sent (selected or not selected) code: .jqgrid('navbuttonadd', '#pager', { caption: "send command ", buttonicon:"ui- icon-signal-diag", title: "send command ", onclickbutton: function () { var selrow = jquery("#list").jqgrid('getgridparam', 'selarrrow'); //get selected rows var datatosend = json.stringify(selrow); if (selrow == 0) { // display error message because no row selected $.jgrid.viewmodal("#" + 'alertmod_' + this.p.id,

android - How to implement ItemAnimator of RecyclerView to disable the animation of notifyItemChanged -

in project need disable "change" animation of recyclerview while notifyitemchanged . i investigated in source of recyclerview , had overridden android.support.v7.widget.defaultitemanimator below: private static class itemanimator extends defaultitemanimator { @override public boolean animatechange(recyclerview.viewholder oldholder, recyclerview.viewholder newholder, int fromx, int fromy, int tox, int toy) { if(oldholder != null) { oldholder.itemview.setvisibility(view.invisible); dispatchchangefinished(oldholder, true); } if(newholder != null) { dispatchchangefinished(newholder, false); } return false; } } but not sure if match spec of google document: recyclerview.itemanimator.animatechange according understanding source code, if not override method properly, oldholder will not recycled. please me figure out how override animatechange in correct way.

function - Python: Loop isn't waiting for user's input -

normally when input user, python waits until press enter key. in script reason python isn't waiting input , keeps printing text... user_option() , has few print statements in it... if tell me how make wait until user enters input appreciated. code: while true: user_option() decision = input("what coarse of action should take?") decision = decision.strip().lower() if decision == "a": rehydration() elif decision == "b": moderate_speed() elif decision == "c": fast_speed() elif decision == "d": rest() i'm running python 3.4. problem in input method. in python 3.x raw_input() not exits , input() exits. in older version input() , raw_input() exits. according python version use proper method. see more here. in python 3.x can simulate raw_input() using eval(input())

rust - Check whether a char is an alphabet or number? -

what rust equivalents c's isalpha , isdigit , isalnum ? is_alphabetic, is_digit, is_alphanumeric, is_numeric looking for. e.g. : fn main() { println!("1 digit {}", '1'.is_digit(10)); println!("f hex digit {}", 'f'.is_digit(16)); println!("a alphabetic {}", 'a'.is_alphabetic()); println!("こis alphabetic {}", 'こ'.is_alphabetic()); println!("a alphanumeric {}", 'a'.is_alphanumeric()); println!("1 alphanumeric {}", '1'.is_alphanumeric()); } returns: 1 digit true f hex digit true alphabetic true こis alphabetic true alphanumeric true 1 alphanumeric true they described in detail in rust standard library docs chars .

ios - Generating a UIColor with arguments tilt value data in swift -

i'm trying make app change colour of background based on tilt angle of device. i'm having no problem finding tilt values of device, can't seem use tilt values parameters in uicolor. i have following code: let manager = cmmotionmanager() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. manager.gyroupdateinterval = 0.1 manager.startgyroupdates() if manager.devicemotionavailable { manager.devicemotionupdateinterval = 0.01 manager.startdevicemotionupdatestoqueue(nsoperationqueue.mainqueue()) { [weak self] (data: cmdevicemotion!, error: nserror!) in let xcolor = data.gravity.x self!.view.backgroundcolor = uicolor(red: 155/255, green: xcolor, blue: 219/255, alpha: 1) } } } you think generate color varied depending on x-tilt of device, doesn't. type not supported. does know how use "xcolor" variable change gree

android - Storing Values in SharedPreferences -

i trying store values username , password fields using sharedpreferences , use values populate edittext fields. fields not being populated , i'm not sure i'm doing wrong. here login() method called when login button pressed. in set sharedpreferences values if login successful , check box checked. public void login() { mloginprogress.setvisibility(view.visible); string usernamestring = memail.gettext().tostring(); string passwordstring = mpassword.gettext().tostring(); parseuser.logininbackground(usernamestring, passwordstring, new logincallback() { @override public void done(parseuser parseuser, parseexception e) { if (parseuser != null) { // login successful if (msavelogin.ischecked() == true) { sharedpreferences preferences = getsharedpreferences("login", mode_private); sharedpreferences.editor editor

php - How to display an image inside a HTML table using XSL code? -

i created xsl style sheet xml web service. have image link output database on html. xsl display link not image link contain. want display direct image inside html table using xsl. this xsl code <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <html> <body> <h2>birdcatch xslt</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>id</th> <th>species</th> <th width="50%">about_bird</th> <th>date_added</th> <th>address</th> <th>age</th> <th>sex</th> <th>latitiude</th> <th>longitiude</th> <th>image</th> <th>added_by</th>

amazon web services - Aws instance created by autoscale event or not -

i find out if instance spun manually, using script or via auto-scale event. see every instance has requesterid, can use it? if yes, populated when autoscale event spins instance. regards you adding tag auto scaling groups named asgroupname. when create tag using aws web console can check tag new instances option. cause tag propagated down instances created group. able identify instances on whether or not have tag , value of tag give name of group.

ruby on rails - Parent id could not be accessed from child controller create action -

this error: couldn't find task without id i have association: task has_many :appointments appointment belongs_to :task routes: resources :tasks resources :appointments end in task show, (im using partial btw) have link create new appointment page: <%= link_to new_appointment_path(id: task.id) %> in appointments controller: def new @task = task.find(params[:id]) @appointment = @task.appointments.new # @appointment = appointment.new end def create @task = task.find(params[:id]) @appointment = @task.appointments.build(appointment_params) if @appointment.save redirect_to @task else render 'new' end end the problem line in create action: @task = task.find(params[:id]) can me please? rake output tasks#index post /tasks(.:format) tasks#create new_task /tasks/new(.:format) tasks#new edit_task /tasks/:id

javascript - Match last occuring enclosing outer brackets -

i tried 3 hours construct following regex match without success. have following 2 strings: this test string illustrate problem (example) in complex matching logic (work / not working (in case) match last occurring bracket closure) and simpler version of string (matchable in easy way) i define str.match() matches last part of strings above. resulting in: work / not working (in case) match last occurring bracket closure and matchable in easy way any way achieve this? sadly data highly volatile strong regex rather preferred instead of long functional logic. much! you can’t match arbitrarily nested parentheses regular expressions. regular expression engines have been extended in such way can parse kind of grammar, javascript’s has not; you’ll need match manually. function lastparenthesizedsubstring(text) { var end = text.lastindexof(')'); var = end - 1; var nesting = 1; while (nesting > 0) { if (i < 0) { //

python - Get Selected Button from RadioButton Group with Wxpython -

i have 2 wxpython radio button groups: self.red = wx.radiobutton(panel, -1, 'red', (10, q2y), style=wx.rb_group) self.orange = wx.radiobutton(panel, -1, 'orange', (50, q2y)) self.yellow = wx.radiobutton(panel, -1, 'yellow', (100, q2y)) self.dot = wx.radiobutton(panel, -1, 'dot', (10, q3y), style=wx.rb_group) self.triangle = wx.radiobutton(panel, -1, 'triangle', (50, q3y)) self.rectange = wx.radiobutton(panel, -1, 'rectangle', (100, q3y)) is there easy way selected radio button each group without looping through of buttons? bind using wx.evt_radiobutton , use event.geteventobject in event handler selected button. see wxpython demo radiobutton code sample.

javascript - JS - how to remove setTimeOut for my code -

i trying use vertical scroll display object a . idea if scroll height greater scrollheight (15) , after 1.2 second , a show up. when scroll top, hide. the problem right if dont use cleartimeout, settimeout ignore condition: if ( scroll >= scrollheight ) when use cleartimeout , seems works when scroll or doesnt work. here code. var scrollheight = 15; $(window).scroll(function() { var scroll = getcurrentscroll(); var delaythis; if ( scroll >= scrollheight ) { delaythis = settimeout(function(){ //display **a**... }, 1200); } else{ // hide **a** ... cleartimeout(delaythis); } } thank helping!! you have tell script if message showing or not, way avoid multiple delays. below working version of i'm talking about. hope helps. var scrollheight = 15; var message = $( ".message" ); var messagestatus = false; var scrollposition; $(window).scroll(function() {

xcode - Using *new in c++ -

this question has answer here: delete & new in c++ 8 answers i writing simple c++ program in xcode has 1 class message. in main want declare new message , add list messages. xcode suggesting use: messages.push_front(*new message(messageid)); can explain *new does. dynamically allocating memory message object or creating instance of message on stack? have checked in xcode , there no memory leaks if use , not delete instance assume allocating on stack. you allocating message dynamically on heap , dereference pass reference. one of overloads of push_back push_back(const t& value) , value first allocated on heap dereferenced , reference passed function. now useless, directly allocate message(messageid) , pass method. in addition generating leak since there no delete associated new , , can't release since don't bind returned pointer a

c# - Awesomium webcontrol -

so i've been trying use other ie webcontrol in side-project of mine (c#, wpf project type) , looking around alternatives , have tried in past failed implement them. i decided try again , implement awesomium, still confusing , doesn't have straight forward examples me use base. would able show me how implement awesomium webview/webcontrol? vision have navigate shoutbox website, , while application still open keep there (i.e not refresh doesn't lose anything) being shown in space of tabitem. i have used awesomium, last version used 1.6.1, , there differences between , current version - they've made things easier. the documentation says should able force navigation of control setting source property: <osm:webcontrol name="webcontrol" source="http://www.google.com/" /> if find source property not bindable revert using code behind in view - subscribe property change event viewmodel (or event

php - Broken img only on Chrome -

so in here (on bottom of page) can see (only if using chrome) broken image @ bottom left. it turns out accessing directly works. chrome console gives 404 error image. i'm using php file serve image. show arg , use readfile serve image. (the code works, seen in other browsers or accessing directly) i don't know what's deal chrome. any appreciated! i'm using wordpress base, , i'm using following php file filter users ids able see images. sorry if code messy. i'm still learning! <?php define('wp_use_themes', false); require('./wp-blog-header.php'); $current_user = wp_get_current_user(); $current_user_id = $current_user->id; //save idlength compare $idlength=strlen($current_user_id); //check arg if (isset($_get['show'])) { $img="../subidas_cliente/{$_get['show']}"; //check whether file exists if (file_exists($img)){ //admin ids image if($current_user_id==2||$curre

SQL-Server: using an if in the where operator -

i'm creating stored procedure gets values table stores projects funding (their id, goal , they've received far) , proc return either project id's have been funded or haven't given parameter @querytype , don't know how put if condition in where , i've ever used them in select portion of statement. this have far gives me incorrect syntax on first case: --create proc projects.getfundedprojects -- projects have reached goal create proc projects.getfundedprojects (@querytype int ) begin select * stats.fundedprojectstoday case when @querytype = 1 -- projects reached goal aureceived=>projectgoal when @querytype = 2 -- projects have not been funded aureceived<projectgoal end --end case end -- end proc use mutually exclusive conditions each @querytype value: select * stats.fundedprojectstoday (@querytype = 1 , aureceived >= projectgoal) or (@querytype = 2 , aureceived < projectgoal) by way, greater or equal operator wr

android - Is it possible to execute commands remotely (ssh), through a Java program -

i looking ssh ubuntu server via (java) api. possible? here looking exactly: i have setup openstack on ubuntu machine. launched instance ubuntu server. installed android sdk on virtual machine. by ssh-ing virtual machine, able create avd , run emulator (headless). what plan provide web client start emulator @ click of button (considering set i.e virtual machine , running sdk installed). i guess need execute command start emulator. possible via (java) api? had openstack4j , jclouds not find much. tried figure out using ssh client library. right? anything missing here? have @ cloudserverspublish.java example, in particular configureandstartwebserver() method. also note how sshjsshclientmodule added computeservicecontext in constructor. you'll need make sure have jclouds-sshj dependency. <dependency> <groupid>org.apache.jclouds.driver</groupid> <artifactid>jclouds-sshj</artifactid> <version>1.9.0</ve

lua - Requiring a LuaJIT module in a subdir is overwriting a module of the same name in the parent dir -

i have file setup this: main.lua (requires 'mydir.b' , 'b') b.lua mydir/ b.so (luajit c module) from main, this: function print_loaded() k, v in pairs(package.loaded) print(k, v) end end print_loaded() require 'mydir.b' print_loaded() -- include 'mydir.b' instead of 'b': local b = require 'b' the outputs of print s show call require 'mydir.b' setting return value value of package.loaded['b'] expected package.loaded['mydir.b'] . wanted have package.loaded['b'] left unset can later require 'b' , not end (in opinion incorrectly) cached value mydir.b . my question is: what's way deal this? in case, want able copy around mydir subdir of of luajit projects, , not have worry mydir.whatever polluting module namespace destroying later require s of whatever @ parent directory level. in anticipation of people saying, "just rename modules!" yes. can that. i'd

batch file - How to create a .bat loop that creates a new cmd window and runs a different loop/function? -

i have following code: set cont=3 :window start segredo.bat if %cont% equ 0 goto windowend set /a cont=cont-1 goto window :windowend :loopstart echo spam goto loopstart :loopend my objective open 3 cmd windows , run echo spam loop in each 1 of them. instead, start opening infinite cmd windows without running loopstart. i'm kind of new bat language there can me? for /l %%a in (1 1 3) start "" cmd /q /c"for /l %%b in (0) echo spam" inside out an infinite loop needed echo , numeric for /l loop used. "iterate 0 1 in steps of 0" , for /l %%b in (0 0 1) abreviated. as 3 separate instances required, command placed inside cmd instance we use aditional numeric for /l loop, start each of cmd instances. prevent problems commands, start command handles first quoted argument window title, pair of empty quotes included.

google apps script - setFormulaR1C1() doesn't translate to A1 notation in all cases...? -

i'm trying write function sets formula in cell using relative r1c1 notation because don't know row number cell have. i've used cell.setformular1c1(string) twice, in third case i'm not sure what's not working. when pass string setformular1c1() applied cell h34 "=r[0]c[-4]*value(iferror(regexextract(index(cse!i:i;match(r[0]c[-6];cse!a:a;0);1);\"[0-9]+\");\"0\"))" ; should spit out =d34*value(iferror(regexextract(index(cse!i:i,match(a34,cse!a:a,0),1),"[0-9]+"),"0")) ...right? instead not translating string a1 notation , receive parse error. backslashes elsewhere have had success using similar formula... paymentdueformulacell.setformular1c1("=r[0]c[-3]-r[0]c[-2]-r[0]c[-1]"); which, when set cell j34 gets correctly rendered as =g34-h34-i34 can intuit differences might missing? have tried using indirect formula? turns string cell reference. =indirect("some string"&

pointers - Error saving NSManagedObjectContext in swift -

Image
i'm using xcodes auto generated code core data swift project includes function in app delegate: func savecontext () { if let moc = self.managedobjectcontext { var error: nserror? = nil if moc.haschanges && !moc.save(&error) { // replace implementation code handle error appropriately. // abort() causes application generate crash log , terminate. should not use function in shipping application, although may useful during development. nslog("unresolved error \(error), \(error!.userinfo)") abort() } } } when have error managed objects instead of printing message details error app crashes exc_bad_instruction error. in the documentation says: a pointer nserror object. not need create nserror object. save operation aborts after first failure if pass null. is app aborting because error nil? bug or expected behavior? (and if it&#

jquery - div inside if statement javascript -

for reason, div tags not displayed in webpage when program run. tested every other component , have figured out problem setting of value of div tags in if statement. problem not know how fix problem , still have program run way want to. <div id="answerdisplay"></div> <div id="correctornot"></div> <script> var div var div2 var rightanswer var problemnum =math.floor((math.random() * 3) + 1); if (problemnum == 1){ rightanswer = 14; div = document.getelementbyid("answerdisplay"); div.textcontent = "4 + 2 * (10 - 3 * 2) / 4 + 8 = ?"; } else if (problemnum == 2){ rightanswer = 8; div = document.getelementbyid("answerdisplay"); div.textcontent = "(6 - 3) * 2 + (3^2 - 5) / 2 = ?"; } else if (problemnum == 3){ rightanswer = 6; div = document.getelementbyid("answerdisplay"); div.textcontent = "5 - 3 + 4^2 / (8 - 4 / 2) = ?"; } else if (problemnum == 4){ rightanswer = 3

class - TObjectList<> Get item error -

i'm trying create tobjectlist class in delphi xe8, errors when try value. compiler error message: "[dcc32 error] : can't access private symbol {system.generics.collections}tlist.getitem" here code: unit unit2; interface uses classes, system.sysutils, system.types, rest.types, system.json, data.bind.components, system.regularexpressions, system.variants, generics.collections; type ttruc = class public libelle : string; constructor create(plibelle : string); end; tlistedetrucs = class(tobjectlist<ttruc>) private function getitem(index: integer): ttruc; procedure setitem(index: integer; const value: ttruc); public function add(aobject: ttruc): integer; procedure insert(index: integer; aobject: ttruc); procedure delete(index: integer); property items[index: integer]: ttruc read getitem write setitem; default; end; implementation { ttruc } constructor ttruc.create(plibelle: string); begin libe

python - A better way to do it in Pandas, I have 2 loops -

new pandas ; there better way ? import pandas pd import numpy np stringio import stringio devices = stringio("""name;date;cpu;freq;voltage rpi;201501;arm;700mhz;5v galileo;201501;intel;400mhz;3.3v uno;201502;atmel;16mhz;5v """) d = pd.dataframe.from_csv(devices, sep=';', index_col=none) comments = stringio("""comment;t1;t2;t3 cool;arm;; great!;atmel;; great!;intel;5v; fun;atmel;16mhz; fun;700mhz;atmel; """) c = pd.dataframe.from_csv(comments, sep=';', index_col=none) n = d.copy() n['cool'], n['great!'], n['fun'] = 0, 0, 0 i, row in n.iterrows(): j, com in c.iterrows(): if np.all(np.in1d(np.array(com[['t1', 't2', 't3']].dropna()), np.array(row))): n.loc[i, c.loc[j, 'comment']] = 1 at end, build new dataframe n, , looks that: name date cpu freq voltage cool great! fun 0 rpi 201501 arm

PHP Script for Windows Server Information -

i have created below script works fine , me uptime of current server - <?php $server = $_post['server']; // digits $pattern = '/[^0-9]/'; ?> <html> <head> <title>uptime</title> </head> <body> <?php $uptime = `c:\windows\system32\uptime2.bat $server`; $uptime = explode(": ", $uptime); $uptime = explode(", ", $uptime[1]); $uptime_days = preg_replace($pattern, '', $uptime[0]); $uptime_hours = preg_replace($pattern, '', $uptime[1]); $uptime_minutes = preg_replace($pattern, '', $uptime[2]); $uptime_seconds = preg_replace($pattern, '', $uptime[3]); echo '<b>uptime:</b><br><br>'; echo 'days: '.$uptime_days.'<br>'; echo 'hours: '.$uptime_hours.'<br>'; echo 'minutes: '.$uptime_minutes.'<br>'; echo 'seconds: '.$uptime_seconds.'<br>'; ?> </body>

node.js - Creating a yieldable Node Module/Object -

i trying create node module (using harmony) upon loading module/application, has yielded things in it's construct can executed , loaded before of it's exposed functions can called. the issue having cannot seem yield internal function being executed, using module.exports . example help. module.exports = function*(s_id){ console.log('loading module lets execute till here'); if (!(this instanceof tester)) return yield new tester(); } function* tester(){ console.log('but never execute generator function'); } tester.prototype = { model : function*(){ // other functions } } it's been stumping me hours now! feel solution super simple cannot seem wrap head around it. have tried make tester() function export, still having same issue. why can't seem yield tester() function? also, may alternative approach? want maintain object nature of module module can loaded different inputs, such s_id variable/object

telerik - Using Firebase in Native Script -

i went through documentation @ native script find way use firebase in native script apps. 1 know how use firebase in native script apps? note: copy , paste of other answer here . i've built nativescript-firebase , loads firebase node.js sdk in way that's compatible nativescript. also, eddy verbruggen has written nativescript-plugin-firebase uses firebase's corresponding android , ios sdks.

python 2.7 - Split string before regex -

i'm trying insert tab (\t) before regex, in string. before " x days ago", x number between 0-999. the text have looks this: great product, fast shipping! 22 days ago anon fast shipping. got free! thanks! 42 days ago anon desired output: great product, fast shipping! \t 22 days ago anon fast shipping. got free! thanks! \t 42 days ago anon i still new this, , i'm struggling. i've looked around answers, , found close, none identical. this have far: text = 'great product, fast shipping! 22 days ago anon' new_text = re.sub(r"\d+ days ago", "\t \d+", text) print new_text output: great product, fast shipping! \d+ anon again, need (note \t): great product, fast shipping! 22 days ago anon you can use backreferences in replacement string. put parantheses around \d+ days ago make captured group , use \\1 inside replacement refer group's text: >>> text = 'great product, fast shipping

android - Db Handler returning null and cannot create table? -

i have database class using connect sql lite database listview class stores context stuff such retreieving rows simple getpaitnets failling full class public class databasehandler extends sqliteopenhelper { private static final int database_version = 1; private static final string database_name = "cautiomanager", table_contacts = "patient", key_id = "id", key_name = "name", key_phone = "phone", key_contactphone = "contactphone", key_email = "email", key_address = "address", key_imageuri = "imageuri"; public databasehandler(context context) { super(context, database_name, null, database_version); } @override public void oncreate(sqlitedatabase db) { db.execsql("create table " + table_contacts + "(" + key_id + " integer primary

python - Displaying a list as string -

i pretty new python, , writing code program queries , displays map image id's satellite images. the images compiled list, , print list string, new lines between each image id. image id's saved separate entries in list, when try print result list_ = result list_as_json = json.dumps(list_) mybigstring = "\n".join(list_as_json) print mybigstring or mybigstring = "" s in list_as_json: mybigstring = mybigstring + "\n" + s print mybigstring it ends printing every letter id on different line. so, instead of printing like: landsat/le7_l1t/le70160402014017edc00 landsat/le7_l1t/le70160402014033edc00 landsat/le7_l1t/le70160402014049edc00 landsat/le7_l1t/le70160412014017edc00 landsat/le7_l1t/le70160412014033edc00 landsat/le7_l1t/le70160412014049edc00 it prints: l n d s t / l e 7 _ l 1 etc. if enter print list_as_json i get: ["landsat/le7_l1t/le70160402014017edc00", "landsat/le7_l1t/le70160

Windows Batch CMD windows Closes fast even with Pause at end of File -

i have batch file has content for /f "tokens=1-4" %%a in ("reg query hkcu\environment\") ( echo %%a %%b ) pause however when run this, cmd window opens expect closes fast, before can read text. can prevent this, , why happening. doesn't happen on machine too, can try run command line: cmd /k your_file.bat

mysql - Update Two Tables -error - Unknown column 'product_varities.product_varities_id' in 'where clause' -

i trying update 2 tables, taking data 1 table , updating second table. keep getting error: 1054 - unknown column exception in mysql. orderlines orderlinesid quantity product_varities_id (fk) product varities product_varities_id (pk) quantity stored proc: begin declare quantitytoaddback int(5); select orderlines.quantity orderlines orderlines.order_id = iorderid , product_varities.product_varities_id = iproductvaritiesid quantitytoaddback; -- update first update orderlines set orderlines.`status_id` = 2 orderlines.order_id = iorderid , orderlines.product_varities_id = iproductvaritiesid; -- update quantity update product_varities set product_varities.quantity = product_varities.quantity + quantitytoaddback product_varities.product_varities_id = iproductvaritiesid; end i don't understand doing wrong, executing 2 statements because research on here found cannot update 2 tables @ once. from given description looks iorderid , iproductvaritiesid input val

Append/join (bit shift) one binary value before another in Java -

i want able 'insert/append' 1 binary after another. int variables @ moment. int = 1; int j = 4; i want bit shift left 3 i add values together. for example, i binary: 1 (1) j binary: 100 (4) result: 1100 (12) public static int appendbinary(int i, int j) { string istr = integer.tobinarystring(i); string jstr = integer.tobinarystring(j); string binary = istr + jstr; return integer.parseint(binary, 2); } this method converts , j binary, subs before j, , converts result int. hope helps!

MySQL datediff strange results -

i getting weird results datediff function. it's 0 different , same timestamps? select datediff('2015-04-25 20:37:45','2015-04-25 05:20:00'); +-------------------------------------------------------+ | datediff('2015-04-25 20:37:45','2015-04-25 05:20:00') | +-------------------------------------------------------+ | 0 | +-------------------------------------------------------+ select datediff('2015-04-25 20:37:45','2015-04-25 20:37:45'); +-------------------------------------------------------+ | datediff('2015-04-25 20:37:45','2015-04-25 20:37:45') | +-------------------------------------------------------+ | 0 | +-------------------------------------------------------+ if @ mysql manual: datediff datediff() returns expr1 − expr2 expressed value in days 1 date other. expr1 , expr2 date or date

java - Counting chars in String doesn't work with tabs ('\t'). Am I using wrong methods? -

i want count every char in string. every char adds 1 counter , tabs should add 4. my code is: int counter = 0; for(char c : mystring.tochararray()) { if("\t".equals(""+c)) { counter = counter + 4; } else { counter++; } } i've made lot different lines in text editor , set tab space 4. lines chars , numbers no problem. add few tabs in between result greater 1. editor says line 100 characters long code counts 101. doesn't matter if there 2 or 20 tabs in line. counts 1 much. any ideas or better solutions? maybe used methods cause behavior? edit: testing lines: line 12: 121 characters ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd line 13: 120 characters dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd line 14: 119 characters tabs kkk line 1