Posts

Showing posts from June, 2014

Powerbuilder 8 code -

we have application built in powerbuilder 8. have 0 experience powerbuilder 8 , limited programming experience in general. 1 of functions of application take filename (.txt) enter, in directory , process file adding our sql database. found job in sql believe being executed powerbuilder program having tough time navigating powerbuilder find code confirms that. any suggestions? thanks, scott perhaps can share. have pb app. search thru app, need .pbl files. if have pbd's more difficult , requires additional software. i going assume have actual pb 8 powerbuilder software. the. workspace , target defined , can see library list. systree on toolbar since new, may seem lot of information need able search application. if pbl's available , other defined mentioned above search on ifexists. may determine if functionality there. have day , best of luck.

windows - Maven returns an error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1 -

i have project maven in netbeans ide 8.0.2 when perform action: 1. clean , build 2. run displays error: failed execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project springscope: command execution failed. process exited error: 1 (exit value: 1) -> [help 1] to see full stack trace of errors, re-run maven -e switch. re-run maven using -x switch enable full debug logging. <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.hubberspot.spring</groupid> <artifactid>springscope</artifactid> <version>1.0-snapshot</version> <packaging>jar</packaging> <properties...

Call to undefined function gcb() In wordpress -

Image
fatal error: call undefined function gcb() in d:\wamp\www\isee\wp-content\themes\isee\home.php on line 10 and code */ get_header(); echo homeslider_function(); ?> <article id="first-article"><?php echo gcb(1);?></article> <article id="second-article"><?php echo gcb(2);?></article> line no 10 gcb(1) it looks need install global code blocks plugin. from faq page : can use content blocks outside of posts , pages? yes, wrap in php function <?php echo gcb(x);?> x content block id. can use longer form <?php do_shortcode("[contentblock id=x]");?>

oracle10g - how to make run sql query fast the following query keep on running suggest me how to optimize it -

/* formatted on 2015/06/24 15:51 (formatter plus v4.8.5) */ select (select name dept deptid = department) name, sum (received), sum (notresponded) (select trim (regexp_substr (b.dept, '[^,]+', 1, level) ) department, count (*) received, count (*) - count (case when round ( ( to_date (to_char (clssndtm, 'yyyy-mm-dd hh24:mi' ), 'yyyy-mm-dd hh24:mi' ) - to_date (to_char (made, ...

Replacing a text in file in C++ using Qt -

i using qt library , trying change contents of file. want replace text stored in tok2 fname. updated code: qfile file(destpath); if (file.open(qiodevice::readwrite | qiodevice::text)) { qtextstream stream(&file); while (!stream.atend()) { qstring line = stream.readline(); qstringlist tokenlist = line.split("\t"); if ( tokenlist.count() == 2 && (tokenlist.at(0).endswith("file",qt::caseinsensitive))) { qstring tok1 = tokenlist.at(0).trimmed(); qstring tok2 = tokenlist.at(1).trimmed(); qfileinfo relpath(tok2); qstring fname = relpath.filename(); qstring newline = tok1.append(" ").append(fname); qstring oldline = tok1.append(" ").append(tok2); qdebug() << "original line: " << oldline << "new line" << newline; qtextstream in(&file); while (!in.atend()) { qstring line ...

c++ - Sort a deque containing struct -

i want sort deque according int g value contained in node struct. structure of program this: struct node { int x; int y; int g; }; deque<node> open; this sorting function trying gives garbage values. please guide me: deque<node> sort(deque<node> t) { deque<node>::iterator it; int size= t.size(); node te; for(int i=0; i<size; i++) { for(int j=0; j<size-i; j++) { if(t[j].g < t[j+1].g) { te.x = t[j].x; te.y = t[j].y; te.g = t[j].g; t[j].x = t[j+1].x; t[j].y = t[j+1].y; t[j].g = t[j+1].g; t[j+1].x = te.x; t[j+1].y = te.y; t[j+1].g = te.g; } } } for(it=t.begin();it!=t.end();it++) { te = *it; cout<<te.x<<","<<te.y<<","<<te.g<<...

html - Rails redirects back again to the same page after submitting form -

[updated question, please see latter half] i'm bulding simple web application has simple sign-up/login form. system want have is you put name , keyword in form.(at /save_user.html) press "confirm" link check if username used or not. true -> update, false -> register redirect /goodbye.html (controller) now testing new username/keyword set every time. problem is, final output /save_update , , ends error says no parameters givin. (of course no parameters givin) i's there can this? thankyou! controller # # register user # def save_user point_id = session[:point_id] @point = point.find(point_id) end def save_update username = params[:user][:name] keyword = params[:user][:key] point_id = session[:point_id] # # if username exists, match password. # if not, create new. # user = user.find_by_username(username) if user if user.keyword == digest::sha1.hexdigest(user.salt + keyword) # user exists! render text: ...

linux - why can I fork without include a headfile -

int main() { fork(); return 0; } unistd.h hasn't included in file, why can program still work include right head file? at least gcc has set of standard includes. it's toolchain-specific behaviour. should still #include <unistd.h> make sure code portable.

exception - How can I fix java.lang.ExceptionInInitializerError? -

i writing game , in last phrase. going write load class when press load button, exception, caused null pointer. however, allocated every object , arrays new . moreover, have points non- static volatile . this code: class loadstate { private char[] mapx; int x=0, y=0; public loadstate()throws filenotfoundexception, ioexception { string line; (int i=0;i<10;i++) { gameplay.tm[i].start(); } } gameplay.t.start(); int flag=0; int m=0; bufferedreader fr=new bufferedreader(new filereader("save.txt")); while((line=fr.readline())!=null){ if(flag==0){ gameplay.me.name=line; } if (flag==1){ gameplay.tt.time=integer.parseint(line); } else if(flag==2){ gameplay.lvl=integer.parseint(line); } else if(flag==3){ gameplay.win=boolean.parseboolean(line); } else if(flag==4){ ...

regex - regexp_extract hive not working as expected -

i started working hive data preparation , ran peculiar problem when using regexp_extract udf. working on xml structures , trying extract elements xml-string. here example. string operating on is: <b>ajsdnf</b> <a>asdhf</a> <a>alfnv</a> <b>ajsdnf</b> <a>test</a> the regular expression (<a>.*?<\/a>) should extract strings contains elements tags. when check logic on regex101 finds right groups. however when run against hive this select regexp_extract('<b>ajsdnf</b><a>asdhf</a><a>alfnv</a><b>ajsdnf</b><a>test</a>','(<a>.*?<\/a>)',0) some_table limit 1; it returns first <a>asdhf</a> . according documentation of regex_extract should return occurrences if pass integer 0 3rd parameter. there chance can achieve following result <a>asdhf</a> <a>alfnv</a> <a>test</a> and i...

artisan - Laravel collection pluck method not working as expected -

Image
i've entered fantastic world of laravel , looking seeding database fake data testing. i have couple of tables want work with; projects , stories . the stories table has columns; id , name , project_id (which fk projects table). my projects table populated list of 10 projects. need populate 100 stories random projects associated. have approach below. public function run() { db::table('stories')->delete(); db::statement('alter table stories auto_increment = 1'); $faker = faker::create(); foreach(range(1, 100) $index) { story::create([ 'reference' => $faker->numberbetween(1, 9999), 'name' => $faker->sentence(6), 'project_id' => project::orderby(\db::raw('rand()'))->get()->first()->pluck('id') ]); } } i don't know if best way of doing need. however, when performing code every story's project_id set 1; f...

jquery - Javascript not adding id in address bar -

for reason javascript not add id of clicked element address bar. else correctly. here jsfiddle: http://jsfiddle.net/4x7la64s/ so example if click on #introduction want put id in address bar so: example.com/page.php/#introduction based in code, after doing: e.preventdefault(); you like: var hash = jquery(this).attr("href"); //your clicked link if (window.history && window.history.pushstate) { history.pushstate(null, null, 'hash'); // won't make page jump id } else { location.hash = hash; //this fallback old browsers , make page jump id }

sql - How do you think I should write a query?(MySQL) -

i trying write query fetch data 3 tables know how write query exactly. i trying merge 3 tables. in first table has id , data_name, second table data_id, option_id , property , third table user_id, data_id. for example: first table id -- data_name 1 - veri1 2 - veri2 3 - veri3 second table data_id-- property -- option_id 1 ---------- blue ---- 1 1 ---------- cold ---- 2 2 ---------- gray ---- 1 2 ---------- hot ---- 2 3 ---------- green---- 1 3 ---------- cold ---- 1 third table user_id --- data_id 1 ------- 2 2 ------- 3 3 ------- 1 this should output. user: 1 data: veri2 properties: gray - hot what should sql query? this 1 should requested select third.user_id user, first.data_name data, group_concat(second.property separator ' - ') third_table third left join (first_table first, second_table second) on third.data_id = first.id , second.data_id = first.id group third.user_id group_concat , group by cooperate list of properti...

C++ error cannot specify explicit initializer for arrays for char g[] -

i have declared following struct : const struct database_already_exists { const int code = 2001; const char str[] = "database exists."; }; but when pass function: database_already_exists db_err; error_output(db_err.str, db_err.code); it throws following error(visual studio 2013): cannot specify explicit initializer arrays here declaration error_output: template<class d> char* error_output(d err_str, int err_code = 0) { return "(" + err_code + ") " + err_str; } how should change definition str member of struct eliminate such error? i think can modify code below; return "(" + err_code + ") " + err_str; doesnt make sense, can't apply + operator on 2 char * 's . #include <string> #include <iostream> #include <cstring> #include <sstream> struct database_already_exists { database_already_exists(const char* s) : str(s) {} static const int code = 200...

xaml - ControlTemplate(Style) binding ItemsSource property -

i want data binding in style(controltemplate) in listview my listview looks like: <listview itemtemplateselector="{staticresource itemtemplate_selector}" itemcontainerstyleselector="{staticresource itemcontainerstyle_selector}"/> most of properties fetched itemssource binding in datatemplate: e.g. <datatemplate x:key="oneofitem"> <grid> <grid.rowdefinitions> <rowdefinition height="30"/> <rowdefinition height="*"/> </grid.rowdefinitions> <textblock grid.row="0" text="{binding name}"/> <stackpanel grid.row="1"> <richtextblock grid.column="0" local:hyperlinkextensions.text="{binding message}"/> <textblock grid.column="1" text="{binding time}"/> </stackpanel> </grid> </datatemplate...

Why my command of bash shell is not working? -

i add environment value in ~/.profile export test1="abc" i execute bash shell script go.sh #!/bin/bash source ~/.profile but result of go.sh not working.(can't find test1 variable). set | grep test1 otherwise when execute go.sh in command line, working. (can find test1) why go.sh not working? when execute script, new process created own environment. when prompt back, script finished, , cannot access variables. you have source script: source go.sh if want shortcut reading profile, use alias : alias go='source ~/.profile'

javascript - how to import multiple JSON data into table using ng-Tables -

i using ng-table angularjs , using single json file table data. want import multiple json files single table. able import single json file using code below. thank in advance. html <table ng-table="tableparams" show-filter="true" class="table ng-table-responsive"> <tr ng-repeat="user in $data"> <td data-title="'id'" sortable="'id'"> {{user.id}} </td> <td data-title="'name'" sortable="'name'" filter="{ 'name': 'name' }"> {{user.name}} </td> <td data-title="'email'" sortable="'email'"> {{user.email}} </td> <td data-title="'ad...

ios - Need help saving bool to NSUserDefaults and using it in a if statement using Swift -

i struggling figure out how if statement bool saved nsuserdefaults using swift. believe know how save bool nsuserdefaults confirmation in appreciated. objective-c code trying figure out how use swift. if(![[nsuserdefaults standarduserdefaults] boolforkey:@"onoroff"]) { [[nsuserdefaults standarduserdefaults] setbool:yes forkey:@"onoroff"]; } this have far in swift... if nsuserdefaults.standarduserdefaults().objectforkey("onoroff") != nil{ nsuserdefaults.standarduserdefaults().setbool(false, forkey: "onoroff") } i think might have figure out. can confirm correct way save bool nsuserdefaults , use if statement it. here is... if !nsuserdefaults.standarduserdefaults().boolforkey("onoroff"){ nsuserdefaults.standarduserdefaults().setbool(true, forkey: "onoroff") }else{ nsuserdefaults.standarduserdefaults().setbool(false, forkey: "onoroff") } if nsuserdefaults.standarduserdefaults()...

javascript - Catching a textbox value which is stored in a variable -

this controller. public class homecontroller : controller { public static string commstring = ""; public homecontroller() { fwutility.connstring = "data source=.;initial catalog=northwind;uid=sa;password=123"; } public actionresult index() { return view(); } public static datatable getdata(string customerid) { string strfilter = "'" + customerid + "%'"; commstring = "select * customers customerid " + strfilter; return fwutility.getdatatable(commstring); } this view. <script type="text/javascript"> function buttonclick() { var value = $('#text1').val(); alert('@homecontroller.getdata("d").rows.count.tostring()'); } </script> <input type="text" id="text1" value="a" /> <input type="text" id="tex...

java - Conventions regarding the return type for add() methods -

what java programming convention add(...) methods? example: treeset : public void add(...) biginteger : public biginteger add(...) why treeset return type void, while biginteger return type biginteger ? when should use void in own methods? if add operation immutable, should return value (this case of biginteger ). else should return void (the case of collection , example, treeset ).

CSS percentage position minus a pixel -

is there way following in plain css? .item { width: 85% - 1px; } in other words, want item 85% width, minus 1 pixel (ignore border). how accomplish this? there css calc function. https://developer.mozilla.org/en-us/docs/web/css/calc in case, this width: calc(85% - 1px);

c# - Setting nested properties via an Expression -

i have following object: public class contactimport { public long id {get;set;} public contact contact {get;set;} public company company {get;set;} public address address {get;set;} } i want able set properties on the nested objects dynamically based on expression passed in ( expression<func<t, dynamic>> ). to have following method, works fine setting properties on top level object (such id) fails when trying set on nested objects (such contact.firstname) public static void setpropertyvalue<t, tprop>(this t target, expression<func<t, tprop>> member, tprop value) { var selectorexpr = (memberexpression)(member.body unaryexpression ? ((unaryexpression)member.body).operand : member.body); if (selectorexpr != null) { var property = selectorexpr.member propertyinfo; if (property != null) { property.setvalue(target, value); } } } it looks it's trying set property on top level obj...

bash - loop; passing two argument - 1:1 mapping -

if have 50 different files rename (or anything, 2 arguments). how loop or other method ? mv $1 $2 i dont want pass argument each instance. $1 = ab , $2 = 1 . 50 differnt filenames. say have list of txt files in current directory want rename: for f in *.txt; mv "$f" "renamed_$f"; done i suggest adding echo after see how command execute first, , removing echo if looks good. for common file renaming tasks might want consider using mmv allows pattern-based file renaming more easily.

raspberry pi - Python whats the most efficient way to wait for input -

i have python program want run in background (on raspberry pi) waits gpio input performs action , continues waiting input until process killed. what efficient way achieve this. understanding using while true not efficient. ideally use interrupts - , use gpio.wait_for_edge - need in loop or way of continuing operation upon completion of handler. thanks according this: http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio gpio.wait_for_edge(23, gpio.falling) wait transition on pin 23 using interrupts instead of polling. it'll continue when triggered. can enclose in try: / except keyboardinterrupt catch ctrl-c. if want continue processing should register call function interrupt. see: http://sourceforge.net/p/raspberry-gpio-python/wiki/inputs/ def callback(channel): here gpio.add_event_detect(channel, gpio.rising, callback=my_callback) continue program here, in sort of state machine

How to extract images from a file using Apache TIka? -

i have pdf (or other type of files such .doc, .ppt, etc) contain text images. how can extract images files using tika? can run ocr on extracted images using tess4j or other lib? this how call tika: autodetectparser parser = new autodetectparser(); bodycontenthandler handler = new bodycontenthandler(writelimit); metadata metadata = new metadata(); inputstream stream = new fileinputstream("file.pdf"); parser.parse(stream, handler, metadata); p.s. have tika-app.jar. the way this: inputstream stream = new fileinputstream(inputfile); parser parser = new autodetectparser(); bodycontenthandler handler = new bodycontenthandler( integer.max_value); tesseractocrconfig config = new tesseractocrconfig(); pdfparserconfig pdfconfig = new pdfparserconfig(); parsecontext parsecontext = new parsecontext(); parsecontext.set(tesseractocrconfig.class, config); parsecont...

ios - Equalize lineHeight in a NSAttributedString with different fonts -

i have nsattributedstring used set attributed text of uitextview. there 2 different fonts depending if character latin or chinese. problem lineheight attributes different each font , result 2 different line spacing in text view (depending if there latin character in line above or not, because lineheight of latin font higher chinese font) so question : there way equalize lineheight ?

How to take fulllength screenshot not only the visible area in android real devices by using appium, python and selenium webdriver? -

i trying full length screenshot webpage responsive .i able screenshot visible part.is there chance screenshot visible scrolling down.i using python,selenium webdriver , appium.below code desired_caps['platformname'] = 'android' desired_caps['platformversion'] = '4.3' desired_caps['devicename'] = 'galaxy s3' desired_caps['browsername']='chrome' self.driver = webdriver.remote('http://localhost:4723/wd/hub', desired_caps) self.driver.get('http://www.google.com/');(not url) self.driver.implicitly_wait(30); self.driver.save_screenshot('mobile_app.png')

terminal - What is the Powershell equivalent of the command "find | grep 'mystring'"? -

what powershell equivalent of command find | grep "mystring" the equivalent of find in powershell get-childitem , equivalent of grep select-string , have: get-childitem -name | select-string "mystring" you can use common aliases of commands ( gci , sls , respectively) shorten bit: gci -n | sls "mystring"

javascript - Need a cookie to save the size of the font -

i have written code resizes fonts when user clicks on 'increase' or 'decrease' , set cookie save fontsize of browser 5-7 days. the jquery here: $('.fontinc').on("click", function() { // increase current size 1 currentsize = parseint($('body').css('font-size')) + 1; if(currentsize <= 20) $('body').css('font-size', currentsize); }); $('.fontdec').on("click", function() { // decrease current size 1 currentsize = parseint($('body').css('font-size')) - 1; if(currentsize >= 12) $('body').css('font-size', currentsize); }); now assumed if wrote $.cookie("savefontsize", currentsize, {path:'/', expires: 5}); save 'currentsize' 5 days refresh browser font returns default... what doing wrong? need see html? i'd you're missing part read cookie on pageload. $(document).ready(funct...

ruby on rails - Save new user via IP alone (anonymous, like Yik Yak) -

Image
i'm having trouble creating users via ip. no logins, no signups, yik yak. i'm able create users in terminal, can't seem translate code. in terminal can create users doing this: irb(main):001:0> user=user.new => #<user id: nil, current_ip: nil, created_at: nil, updated_at: nil> irb(main):002:0> user.current_ip="159.5.159.11" => "159.5.159.11" irb(main):003:0> user.save here's have @ point. can't ip save new user when run in rails server. missing here? routes.rb rails.application.routes.draw resources :users root 'users#create' users_controller class userscontroller < applicationcontroller before_action :set_user, only: [:show, :edit, :update, :destroy] cattr_accessor :current_ip .... def create @user = user.new(user_params) @user.current_ip=request.env['remote_addr'] @user.save respond_to |format| if @user.save format.html { redirect_to @user, notice: 'user created.' } ...

phantomjs stuck fetching SVG with base64 encoded pattern -

i using https://github.com/vidalab/banquo-server create png svg uses phantomjs. i dont know if there problem phantomjs or svg why im posting here , not on github (quicker response too). <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" id="creator-svg" width="488" height="350"> <desc>created snap</desc> <defs> <pattern x="0" y="0" width="20" height="20" patternunits="userspaceonuse" id="patternsibdh4mpauu" viewbox="0 0 20 20"> <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="data:image/svg+xml;base64,phn2zyb4bwxucz0iahr0cdovl3d3dy53my5vcmcvmjawmc9zdmciihdpzhropsixnsigagvpz2h0psixnsi+cjxyzwn0ihdpzhropsi1mcigagvpz2h0psi1mcigzmlsbd0iizi4mjgyoci+pc9yzwn0pgo8y2lyy2xlign4psiziibjet0inc4ziibypsixljgiigzpbgw9iimzotm5mzkipjwvy2lyy2xlpgo8y2lyy2xlign4psiziibjet0imyigcj0ims44iibm...

listview - android searchView hava one issue -

Image
i have listview on listview have searchview filter item list.its work fine problem when click on searchview title textview no hidden . know how hide textview when click on searchview the example below in picture want hide textview food calories when click on searchview. this ml code of searchview , textview <searchview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/searchview" android:layout_alignparenttop="true" android:layout_toleftof="@+id/button1" android:layout_tostartof="@+id/button1" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="food calories" android:id="@+id/tex" android:layout_alignparenttop="true" android:layout_centerhorizontal=...

Dropwizard/Groovy - ERROR io.dropwizard.jersey.errors.LoggingExceptionMapper: ! groovy.lang.MissingMethodException -

i'm trying create restful web api dropwizard. believe have database connected , running properly. whenever try perform request specific item run error message: error [2015-07-08 21:55:23,867] io.dropwizard.jersey.errors.loggingexceptionmapper: error handling request: 084335cfa9b38151 ! groovy.lang.missingmethodexception: no signature of method: static edu.oregonstate.mist.catalogapitest.db.coursedao.findbycrn() applicable argument types: (java.lang.integer) values: [12345] not sure, think may jetty issue rather dropwizard problem. below have included code believe problem may be. coursedao.groovy package edu.oregonstate.mist.catalogapitest.db import edu.oregonstate.mist.catalogapitest.core.course import edu.oregonstate.mist.catalogapitest.mapper.coursemapper import org.skife.jdbi.v2.sqlobject.sqlupdate import org.skife.jdbi.v2.sqlobject.sqlquery import org.skife.jdbi.v2.sqlobject.bind import org.skife.jdbi.v2.sqlobject.customizers.registermapper @registermapper(c...

broadcastreceiver - blocking specific numbers (call and sms) in android -

i'm creating app in user can choose number block think right algorithm : when phone rings, function check number in list or not (check in database) , if there is, reject call i found code in internet doesn't work,should call onreceive function in activity? should wrote on main activity? here code: public class incomingcallreceiver extends broadcastreceiver { private itelephony telephonyservice; private string blacklistednumber = "+458664455"; @override public void onreceive(context context, intent intent) { telephonymanager tm = (telephonymanager) context.getsystemservice(context.telephony_service); try { class c = class.forname(tm.getclass().getname()); method m = c.getdeclaredmethod("getitelephony"); m.setaccessible(true); itelephony telephonyservice = (itelephony) m.invoke(tm); bundle bundle = intent.getextras(); string phonenumber = bundle.getstring("inco...

symfony - Symfony2 / Plesk change php.ini location -

Image
i'm using plesk panel on server, , have change default path php.ini plesk path /opt/plesk/php/5.6/etc in symfony2 project. it's possible? thanks plesk's php binary /opt/plesk/php/5.6/bin/php uses it's own /opt/plesk/php/5.6/etc/php.ini, not default. if uses default php.ini means use default php binary(/usr/bin/php). default php binary call: ~# php --ini loaded configuration file: /etc/php.ini plesk php binary call: ~# /opt/plesk/php/5.6/bin/php --ini loaded configuration file: /opt/plesk/php/5.6/etc/php.ini in server command/script can use in way: /opt/plesk/php/5.6/bin/php /path/to/your/script.php or in shebang of /path/to/your/script.php: #!/opt/plesk/php/5.6/bin/php maybe need switch php handler php 5.6:

angularjs - Augmenting controller with events -

i writing single page web application parties producing company. my goal create "office like" application allow users open new "party document " , edit it. each document have lot of "content pages" (like food , utilities, attractions ,suppliers etc...) , in each page there many fields. each field have own restrictions should occure when being added , removed or edited. i wanted make base javascript object other fields object inherit . looks : ` function rootcomponent(name,value){ this.name = name; this.value = null; // logic restrictions methods this.onchange = null; this.afterchange = null; this.oncheck = null; this.ondelete = null; this.afterdelete = null; this.onadd = null; // ensure got value if (value !== undefined){ this.value = value; } } ` my question how should augment events of "onchange" , such angular's $watch system.

android - Trouble parsing JSON to string in Java -

i have following json: { data: [ { objecttype: "serviceforbiddenexception", item: { service: "users", action: "index", code: 403, message: "access service [users] forbidden." } } ] } i tried parsing using following snippet: string bodydata = ires.body().string(); try{ jsonobject body = new jsonobject(bodydata); jsonarray data = body.getjsonarray("data"); jsonobject type = data.getjsonobject(0); jsonarray item = data.getjsonarray(1); } catch (exception e) { e.printstacktrace(); } the problem is jsonarray data = body.getjsonarray("data"); is whole data, , not array. how parse correctly? there better libs / ways parse json in java (android) objects created using {} , arrays created using [] . data:[ { } ] is a...

excel 2007 - Find cell address and add a hyperlink based on a tab name -

i have multiple tab (200+) workbook each tab has specific 3-5 digit name. tab's name goes a1 of each respective tab via formula =right(cell("filename";a1);len(cell("filename";a1))-find("]";cell("filename";a1);1)) working ok. i need a1's become clickable (hyperlink) jump me specific cell in first tab (main) in workbook, have column of tab names listed (c6:c280 & growing). plan - =hyperlink(**xxxxxx-add_here-xxxxxxxxx**;right(cell("filename";a1);len(cell("filename";a1))-find("]";cell("filename";a1);1))) tried adding (#'main'!c)&match(right(cell("filename";a1);len(cell("filename";a1))-find("]";cell("filename";a1);1)));main!c6:c280;0) , there mistake somewhere.. pls correct or suggest better/simplier option. thank :) this shared file, no vba/macros/conditional formatting, etc allowed. =hyperlink("#main!c"&match...

.htaccess - Wordpress backend buttons all redirect to homepage -

very peculiar problem: all buttons on wordpress backend change state (update, preview changes, save changes on permalinks, etc.) redirecting homepage without saving. while troubleshooting, able change permalink default , worked fine, though didn't fix redirecting problem, changing else redirect. need fix redirect issue , permalink (/post-name) already disabled plugins , went default theme , problem still existed. thoughts? i'm still new @ this, take grain of salt, surprised @ old cookies etc. stuff that. have tried deleting cookies in internet options? thought. i'll watching see if works, or if else does.

r - Recode 2 variables to one in one line -

say have df like: df=data.frame(a=c(0,0,1,1),b=c(0,1,0,1)) only has long no. of rows. i'd create column depending on simultaneous values of & b, e.g df b c 0 0 10 0 1 11 1 0 12 1 1 13 i take can done inner joins, using sqldf or maybe dplyr; there quicker way, or without libraries? thanks in advance, p i think mean have other data frame (say called dictionary ) c column, , (a, b) in dictionary , grab c there?? df=data.frame(a=c(0,0,1,1),b=c(0,1,0,1)) dictionary <- df dictionary$c <- 10:13 dictionary <- dictionary[sample(4), ] # shuffle prove works in case can do merge(df, dictionary, merge=c('a', 'b'), all.x=t) and grab matching c column dictionary , plonk df . all.x put na there if there no matching (a, b) in dictionary . if speed becomes issue, might try data.table library(data.table) setdt(df) # convert data.table setdt(dictionary) # convert data.table # set key setkey(df,a,b) setkey(dict...

f# - FSharpChart: two scales on same graphic -

Image
i'm using fsharpchart print on same graphic moving average , volume of stock. problem 1 graphic goes 20 50 more or less, other 0 80 mln, when combine two, 1 split bottom , useless. can have 2 different scales on y-axis 2 graphic "merge" correctly? you can if set axistype of 1 of series axistype.secondary . of course it's make sure axis labels, legend, etc make clear data maps scale. open fsharp.charting open system.windows.forms.datavisualization.charting let squareschart = [ 1 .. 100 ] |> list.map (fun n -> (n, n*n)) |> chart.line let cubeschart = [ 1 .. 100 ] |> list.map (fun n -> (n, n*n*n)) |> chart.line let bad = [ squareschart cubeschart ] |> chart.combine let = [ squareschart cubeschart |> chart.withseries.axistype(yaxistype = axistype.secondary) ] |> chart.combine bad: good: this works, in quick testing i've done write answer, appears fsharp.charting has bugs whereby ...

c# - How do I strip valid XML from file that contains excess data and junk -

i have tried parsing regex not xml files being parsed!! tag names not predefined means, solution should identify start , end of xml tag self sample data goes this: <xml data> random text <xml data> random text as said in comments hard problem, without knowledge of data. there lot of edge cases. the code below may work want. attempts find elements ('<element ...' or '<element/>', determine xml content finding end tag. checks trying parse xml , if false rejects xml. this code written clarity, not performance or structure (it's mainline fall-thru). should give example can use starting point type of parsing described. using system; using system.linq; using system.text; using system.xml.linq; namespace messyxml { class program { const string almostxml = @" @#$%random junk <fruits> <apples> pies </apples> <pears> tarts </pears> </fruits> junk fruits apples ...

jquery - I am not able to write javascript array variables values into CSV file in a Given pattern -

Image
i have 3 javascript variables name area, device , problem. want store values of these variables csv file 1 one given in image attached , download sheet on click of download button.both jsp , javascript in same file.i have tried below far. sample.jsp <form> <input type="button" id="downloadbtn" value="download"> </form> <script type="text/javascript"> var area=["area1","area2"]; var device=[["device1","device2"],["device3","device4"]]; var problem=[[["problem1","problem2"]],[["problem3","problem4"]],[["problem5","problem6"]],[["problem7","problem8"]]]; $("#downloadbtn").click(function() { var resp=confirm("do want download?"); if(resp){ var last = ''; (var = 0; < area.length; i+...

typo3 - Specific html tags are not displayed in the frontend -

my backend (rte) shows me: <p> <b>header</b> text <a href="#">link</a> </p> but when open frontend in browser , check source code this: <b>header</b> text link so thought maybe html tags deleted or not stored in database. when reopen in backend (rte): <p> <b>header</b> text <a href="#">link</a> </p> the tags still there. won't displayed in frontend. how can show original code in frontend? maybe target of link not reachable? typo3 checks links , if not accessable, doesn't render link.

javascript - Remove dynamically inserted code -

i discovered following code in page source. hand of plugin using. tried remove jquery did not work. can give me suggestions how should go removing it? tried select unique selector + .remove() did not work. <div style="position: absolute; top: -136px; overflow: auto; width: 1241px;"> <h3> <strong> <a href="http://shopgiaynu.vn" style="font-size: 11.335pt;">shop giày nữ</a> </strong> <strong> <a href="http://thoitrangf5.vn" style="font-size: 11.335pt;">thời trang f5</a> </strong> <strong> <a href="http://themestotal.com/tag/responsive-wordpress-theme" style="font-size: 11.335pt;">responsive wordpress theme</a> </strong> <em> <a href="http://2xaynha.com/tag/nha-cap-4-nong-thon" style="font-size: 10.33...

java - Android prevent app from querying an empty database on startup -

i'm building simple todo/task app in tasks presented in recycler/card view layout , upon selection of task user taken "detailed" view of specific task. i'm testing app using genymotion emulator. problem app crashes upon startup npe. java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.string com.google.api.client.util.datetime.tostring()' on null object reference @ com.github.idclark.forgetmenot.taskadapter.onbindviewholder(taskadapter.java:35) @ com.github.idclark.forgetmenot.taskadapter.onbindviewholder(taskadapter.java:17) although i'm not entirely sure, think because haven't entered data database yet. database first queried fragment inflated main activity. public static class placeholderfragment extends fragment { activity mactivity; recyclerview mrecyclerview; taskadapter taskadapter; addfloatingactionbutton mfabview; checkbox mcheckbox; public ...

regex - accessible longest match (from the beginning) without substring in replacement -

i wondered if possible using sed match longest string (from beginning) not containing substring making match accessible laterwards using sed's regex replacement variables \n . regarding following snippet echo "blabla/a/b/dee/per" | sed -r -e 's:([^/a]*):\1:g' i trying print out longest match containing sign indicated * not including substring /a in way above snippet prints out blabla regarding ( /a deleted/replaced) echo "blabla/b/b/dee/per" | sed -r -e 's:([^/a]*):\1:g' i expecting blabla/b/b/dee/per as output due substring /a not available , longest match leads strings end. stuck @ describing substring /a . caution: [^/a] placeholder describe problem. needs imo replaced correct substring description. possible in way using sed? thank in advance edit: john1024's third answer completes question. following snippet used: sed -r -e 's:(/a|$):\x00:;s:^(.*)\x00(.*):\1:g' edit: fulfill original task ...

javascript - how to structure angular app when using ui-router -

i trying understand how structure parts of angular.js app when using angular-ui-router. have followed this article , created demo app. my app has home page top navbar. , view (say view1) has left vertical navbar. , right pane in i'll show details of item selected in left navbar. currently have put top navbar in template , loading using ng-include in header tag. after have ui-view . what need know is, doing correctly? have googled lot , tried understand functionalities of ui-router , ui-view s. need sure if i'm following standard way. there's not specific piece of code show not posting any. please provide information on same or if resources explain these concepts in detail. i assumed had done research on ui-router. recommend 1 tutorial found useful me when war trying learn ui-route. https://egghead.io/lessons/angularjs-introduction-ui-router website has lot of nice tutorial angular, enjoy.