Posts

Showing posts from March, 2010

maven - Intellij cannot run Spring app with a certain dependency -

i'm working on webapp spring , maven , want able run application within local tomcat server , intellij. dependency seems culprit. <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-tomcat</artifactid> <scope>provided</scope> </dependency> when remove dependency application runs fine in intellij because of other dependency can't run on tomcat. <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> can set automatically use right dependency intellij? you can setup maven profile in pom.xml, use specific profile intellij. intellij allows select profile while running build. <profiles> <profile> <id>intellij</id> … <dependencies> <dependency>…</dependency> </dependencies> … </pr...

entity framework - PostgreSql EF, navigation property is always null when querying -

i stumbled upon unexpected behaviour when using entity framework postgresql. when query context navigation property inside clause, null , fails. if add there include method pointing navigational propery it's working this work context.garages.include("postalcode").where(f=>f.postalcode.regionid == regionid) this not (postalcode null , fails on nullreference) context.garages.where(f=>f.postalcode.regionid == regionid) i don't think had add query when using mssql. can anybdoy explain me. if want navigation properties lazy loaded , need declare them virtual : public garage { //... public virtual postalcode postalcode {get;set;} } in link find conditions must follow entities if want enable lazy loading entities , have entity framework track changes in classes changes occur. if navigation property virtual , other option think cause behavior if turn off lazy loading on context: public class yourcontext : dbcontext { public your...

CMake convert unix to windows path -

i'm trying convert unix style msys path such /c/my/path/to/a/folder windows path, or cmake understand, e.g c:/my/path/to/a/folder . i'd work on path correct. is there proper way ? note : please not mention cygwin's cygpath. edit: file(to_cmake_path mypath result) not working there's no built-in cmake functionality this, can write function/macro it: macro(msys_to_cmake_path msyspath resultingpath) string(regex replace "^/([a-za-z])/" "\\1:/" ${resultingpath} "${msyspath}") endmacro() set(mypath "/c/my/path/to/a/folder") msys_to_cmake_path(${mypath} result) message("converted \"${mypath}\" \"${result}\".") having said that, agree antonio's comment in seems unusual need in first place.

javascript - Minimize Safari on iPad when installing an IPA in iOS 8 -

i use adhoc deployment , supply url install ipa file on ipad. in ios 7 (and previously) safari auto minimize , user see app installing. in ios 8, safari remains open , appears user nothing happening. javascript / html techniques have explored not work close safari. such window.top.close();

asp.net - Stop IIS From Reloading Web.Config File -

my organization runs rather complex application web-based front end. i'm being told 1 of our security products (unknown 1 yet) reading web.config file , apparently simple reading of config file enough trigger iis think web.config file changed. this causes reload of app pool , loss of session state causes users lose of data , "kicked out". how can prevent short of adding exclusions our scanning software? realize that's option, i'm hoping 1 i'm not having make exceptions security systems. clear don't want hear/see answer saying "just add exception scanning software". i'm wanting know of alternatives first. in iis, have ability disable automatic app pool recycling when web.config changes. this, go application pools listing, right-click app pool in question, select "advanced settings", way @ bottom, in "recycling" section, set "disable recycling configuration changes" true. that being said, reading...

Alternative way to left join in SQL ORACLE DB -

if run query below query: select day.m_cmp_typo m_cmp_typo, day.m_sptcv m_sptcv, day.m_cnt_vs2 m_cnt_vs2, day.m_cnt_org m_cnt_org, day.m_pl_cgr2 m_pl_cgr2, day.m_pl_cgu2 m_pl_cgu2, day.m_pl_csfi2 m_pl_csfi2, day.m_pl_ftfi2 m_pl_ftfi2, day.m_pl_rvr2 m_pl_rvr2, day.m_pl_rvu2 m_pl_rvu2, day.m_trn_fmly m_trn_fmly, day.m_trn_grp m_trn_grp, day.m_trn_type m_trn_type, day.m_cnt_vs2 m_cnt_vs2, day.m_c_cur_pl m_c_cur_pl, day.m_instrlabel m_instrlabel, day.m_nb m_nb, day.m_pl_inscur m_pl_inscur, day.m_tp_cntrplb m_tp_cntrplb, day.m_tp_pfolio m_tp_pfolio, day.m_eco_pl m_eco_pl, day.m_cnt_id m_cnt_id, day.m_eco_pl_usd m_eco_pl_usd, day.m_pos_curr2 m_pos_curr2, day.m_curr2 m_curr2, day.m_tp_qtyeq m_tp_qtyeq, day.m_tp_uqtyeq m_tp_uqtyeq, day.m_tp_lqty32 m_tp_lqty32, day.m_tp_uqty m_tp_uqty, --...

java - Invalid deployment descriptor web.xml -

whenever create new servlet on netbeans 8.0.2 shows, invalid deployment descriptor web.xml and there cross sign on web.xml too. web.xml <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <session-config> <session-timeout> 30 </session-timeout> </session-config>

if statement - Perl: foreach line, split, modify the string, set to array. Opendir, next if files=modified string. Unlink files -

i'm having issues following block of code: $output netstat -lnt | grep ":::60". section under comment #create filename format my @lines = split /^/, $output; foreach $line (@lines) { ($garb, $long_ports) = (split /\s*:::\s*/, $line); #get last 2 digits of 60xx port number ($garb2, $ports) = (split /60/, $long_ports); #split values numbers 0-9 correct filename format if ($ports < 10) { ($garb3, $ports2) = (split /0/, $ports); #add 0 since 0 port split empty string if (length($ports2) == 0){ $ports2 = "0$ports2"; } #create file name format @locked_ports = ".x$ports2-lock"; } } %h = map {$_ => 1 } @locked_ports; #open /tmp , find .x*-lock files not match locked_ports opendir (dir, $tmp ) or die "error in opening dir $tmp\n"; while (my $files = readdir(dir)) { if (exists $h{$files}){ next} unlink $files; } closedir(dir); i've tried: #create file name format @locked_ports = ".x$ports2-lock...

php - Recursive function to create a folder tree from array -

so have following: id => id of folder name => name of folder folder_id => null if it's in root, have "id" of it's parent if it's inside folder i have of these listed out in array so: (this $folder_array in example) array ( [1] => array ( [name] => folder1 [id] => 1 [folder_id] => null ) [2] => array ( [name] => folder2 [id] => 2 [folder_id] => null ) [3] => array ( [name] => folder3 [id] => 3 [folder_id] => 2 ) [4] => array ( [name] => folder4 [id] => 4 [folder_id] => 3 ) } i trying make array has folder tree of sorts, i'd like: array ( [1] => array ( [name] => folder1 [id] => 1 [folder_id] => null ) [2] => array ( [name] => folder2 [id] => 2 [folder_id] => nul...

Re arranging the columns in csv file in php -

i m reading csv file , updating csv file , saving it.i want rearrange columns in new file after second column want add tenth column before third ,but when m trying replacing second column tenth column not adding after second one.following code <?php $infile='file.csv'; $outfile='file_updated.csv'; $read = fopen($infile, 'r'); $write = fopen($outfile, 'w'); if ($write && $read) { while (($data = fgetcsv($read)) !== false) { unset($data[1]); $data[2]=$data[10]; fputcsv($write, $data); } } fclose($write); fclose($read); ?> why not make array of order want after , build new data array write. $order = array(1,2,10,3,4,5,6,7,8,9); while (($data = fgetcsv($read)) !== false) { $new = array(); foreach($order $index) $new[] = $data[$index]; fputcsv($write, $new); }

spring - How to update bidirectional @ManyToOne/@OneToMany relationship via REST from the inverse side -

i have 2 entities in spring data rest app: @entity public class question { ... @onetomany(mappedby = "question") private set<answer> answers = new hashset<>(); ... } @entity public class answer { ... @manytoone question question; ... } and spring data repositories both entities: @repositoryrestresource public interface questionrepository extends pagingandsortingrepository<question, long> { } @repositoryrestresource public interface answerrepository extends pagingandsortingrepository<answer, long> { } suppose have question id 1 , 2 answers ids 1 , 2. able link them this: curl -v -x put -h "content-type: text/uri-list" -d "http://localhost:8080/questions/1" http://localhost:8080/answers/1/question curl -v -x put -h "content-type: text/uri-list" -d "http://localhost:8080/questions/1" http://localhost:8080/answers/2/question but not this: curl -v -x put -...

node.js - Can't install anything with npm ECONNRESET without proxy -

i used node.js install things via npm without problems. changed nothing on settings (win8; no proxy, internet working) , can't install (especially cordova , ionic). throws errors i'm behind proxy, i'm not. npm err! windows_nt 6.3.9600 npm err! argv "c:\\program files\\nodejs\\\\node.exe" "c:\\program files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "i" "-g" "ionic" npm err! node v0.12.1 npm err! npm v2.5.1 npm err! code econnreset npm err! errno econnreset npm err! syscall read npm err! network read econnreset npm err! network not problem npm npm err! network , related network connectivity. npm err! network in cases behind proxy or have bad network settings. npm err! network npm err! network if behind proxy, please make sure npm err! network 'proxy' config set properly. see: 'npm config' npm err! please include following file support request: npm err! d:\web\dierechnungsti...

c# - Getting all methods of a target class at runtime -

this question has answer here: how list of properties of class? 9 answers is there way me returned list of methods of target class in form of array of strings @ runtime in c# other parsing documentation class? want emulate ide's suggesting methods types code segment. so method work (ideally) so: getmethods(foo.gettype()) and returned list of foo's methods. using system; using system.linq; namespace consoleapplication1 { class someclass { public void a() { } public void b() { } public void c() { } public void d() { } public void e() { } public void f() { } } class program { static void main() { var methods = getmethods(typeof (someclass)); foreach (var methodname in methods) { console.writeline(methodname); ...

java - Ensuring right data is read from an InputStream -

i have root application supposed capture screen @ point during execution. in order accomplish this, interact android shell using following code: private static process su = runtime.getruntime().exec("su"); private static dataoutputstream outputstream = new dataoutputstream(su.getoutputstream()); private static datainputstream inputstream = new datainputstream(su.getinputstream()); private void capturescreen() { outputstream.writebytes("/system/bin/screencap -p\n"); outputstream.flush(); bitmap bitmap = bitmapfactory.decodestream(inputstream); //outputstream.writebytes("echo test\n"); //outputstream.flush(); } it works fine, when call multiple times, moment issue dummy command produces shell output between capturescreen calls, bitmapfactory.decodestream fails. considering this, have few questions: i assume happens because data within inputstream no longer purely related image data. since runtime single instance (as referred h...

javascript - How do I submit the value of a jQuery variable in a form? -

this should easy question. basically have form without fields, instead want pass along data on user has done on page when clicks submit button. data simple, few integers , strings stored in various jquery/javascript variables. however, i'm @ loss on how pass these variables along form , save in database. should first transform them instance variables , pass along via hidden form fields? should make entire form in jquery? should do? use ajax submit form. otherwise can modify values of form before submit. ie $('#whateverinput').val(yourvalueinavariable); run before form submit , should have new value server-side. don't think need ajax can try if want. can have hidden fields in form , modify values. if want try ajax http://api.jquery.com/jquery.ajax/ , follow format provided ie $.ajax({ url: "urlthatwillacceptdata", data: { javascript object here}, success: function() { want show success message here } });

javascript - catch rejection in $q service without triggering success callbacks -

i have method returns $q ( q ) promise: var subtypesmetadataresolved = restservice.getnodesubtypesmetadata(); now, when metadata available, want run 2 functions process them. first, thought chain them this: subtypesmetadataresolved.then(createnodes).then(preparedataforwidgets) but realized since both require data returned subtypesmetadataresolved promise need return data createnodes success callback it's passed preparedataforwidgets , not option. made this: subtypesmetadataresolved.then(createnodes) subtypesmetadataresolved.then(preparedataforwidgets) which works need. problem how rejection callback called when subtypesmetadataresolved rejected , don't neither createnodes nor preparedataforwidgets callbacks triggered in case? have following, after triggering nodesubtypesmetadataerrorcb triggers createnodes callback: subtypesmetadataresolved.catch(nodesubtypesmetadataerrorcb); subtypesmetadataresolved.then(createnodes) subtypesmetadataresolved.then(pre...

asp.net web api - Inject Default value for Web-Api Method parameter when its null -

i have web api method like; [httpget, route("users")] public httpresponsemessage getusers([fromuri] usersearchdto searchparams) {} the searchparams optional parameter when pass no search values , use http://api-uri/users becomes null , have add check in body of method avoid null reference exception. is there way using actionfilters or else inject default value parameter of web api method avoid if (searchparams == null){ searchparams = new usersearchdto () } not know of. honestly, you're doing pretty it. if want make bit neater, yo can condense null check 1 line so: searchparams = searchparams ?? new userseachdto();

javascript - how to remove element from session storage array when there are lot of -

i trying remove elements localstorage array. find localstorage.removeitem(key); i couldn't understand how works because have 2 sessionstorage. okay? i have far var thecart = json.parse(sessionstorage.getitem("productname")); // retrieving var quantity = json.parse(sessionstorage.getitem("quantityofprod")); var prodprice = json.parse(sessionstorage.getitem("sum")); productname, quantityofprod , sum arrays. don't how form localstorage.removeitem select array , select element inside array. have tried sessionstorage.removeitem("productname", json.stringify(namee)); namee variable contains element want delete inside specific sessionstorage array. doing deleting everything. you have way: read entry decode json remove element encode json update entry tmp = json.parse(sessionstorage.getitem("productname")); delete tmp["key remove"]; sessionstorage.setitem("productname", json.stringif...

javascript - How to Display Column Data in Input Once Different Column Data Has Been Selected? -

Image
i have form select field , input field: the select field takes of customer names customer table's customer_name column, , allows user choose customer name. once customer's name has been chosen, take name , display in "add customer name" input, , take customers phone number (from phone_num column in customer table) , display in "customer phone" input. i using my_sql , php this. so far, can correctly display customer names in "customer" select field. but, name not appear in "add customer name" input nor display customer's phone number in "customer phone" input. does know how using php, javascript, or perhaps mix of both? here code part of web form: <script type="text/javascript"> $(document).ready(function () { $("#customer").change(function() { if($( "#customer option:selected" ).text() == 'add customer') { $( "#cust...

c++ - Calling Qpainter's method paint to refresh image and change color -

i have created object call player inherits qgraphicsobject . what trying change image of player , colour of bounding shape when click on mouse. thing don't know values send player->paint() update image. i override 2 pure virtual functions follows in player.h : class player : public qgraphicsobject { public: player(); qrectf boundingrect() const; qpainterpath shape() const; void paint(qpainter *painter, const qstyleoptiongraphicsitem *option,qwidget *widget); void mousepressevent(qgraphicsscenemouseevent *event); } in player.cpp player::player() { qpixmap m_playerpixmap(":/images/images/chevalier/test1.png"); } qrectf player::boundingrect() const { return qrectf(-15, 0, 128, 130); } qpainterpath player::shape() const { qpainterpath path; path.addellipse(-15, 70, 100, 60); return path; } void player::paint(qpainter *painter, const qstyleoptiongraphicsitem *option,qwidget *widget) { qpen linepen; line...

ios - How do i save an image that was selected by a user with swift? -

in app making, user select photo, appear in imageview. how save image selected in image.xcassets folder, when relaunch app, image still there? here code using... import uikit class viewcontroller: uiviewcontroller, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate { @iboutlet weak var imageview: uiimageview! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @ibaction func action(sender: anyobject) { if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.camera) { let imagepicker:uiimagepickercontroller = uiimagepickercontroller() imagepicker.delegate = self imagepicker.sourcetype = uiimagepickercontrollersourcetype.camera imagepicker.allowsediting = fa...

unit testing - Mobile test automation for iOS and Android -

i wonder if have mobile test automation tool can recommend? after trying several tools cannot find 1 meets every criteria. ranorex can used on both devices after facing many issues have chosen not use it. best tool have encountered robotium, although works on android , therefore not interesting. criteria: possible ci integrate. can used nunit or similar structure. can used on both ios , android. is stable. please not recommend 1 of these recording tools, since (in opinion) not test anything. have nice day thank help. maybe tosca mobile+ of interest you: http://www.tricentis.com/tricentis-tosca-testsuite/tosca-mobile-plus/ tosca follows model based approach - it's not script based, , it's not capture & replay tool. identification of controls done via technology-related properties , imho reliable way stable automation. beside of android & ios, tosca support many more technologies (ui , non-ui). tosca can integrated ci (using e.g. jenkins,...

perl - Make hash from regex expression patten match -error -

i making hash regex expression. run program below , have check @ end see if hash made ok. keep getting error value., array(0x1a1c740), when should 437768. keys can display ok. didnt split because need key first part of species name. matching. # "aaaaaaaaaa","aaaaaaaaaa","437768","cryptophyta sp. cr-mal06",0 thanks may give. use strict; use warnings; open (my $in_fh,"$argv[0]") or die "failed open file: $!\n"; open (my $out_fh, ">genus.txt"); %hash; while ( $line = <$in_fh> ) { # # "aaaaaaaaaa","aaaaaaaaaa","437768","cryptophyta sp. cr-mal06",0 # if ($line =~ m/\"+\w+\"+\,+\"+\w+\"+\,+\"+(\d+)\"+\,+\"+(\w+)+.+/) { $v = $1; $k = $2; $hash{$k} = [$v]; } } if (exists $hash{'cryptophyta'}) { print $out_fh $hash{'cryptophyta'}; } else { print $out_fh ...

c# - ASP.NET Windows Authentication Login screen -

i have ipad app , looking add authentication it. have login page username , password field in app. now able send username , password asp.net api. looking take username , password , authenticate user windows authentication login. after login, able authenticate them before (i.e. run query) i found article: http://geekswithblogs.net/manjunath.k/archive/2014/09/23/windows-authentication-in-asp.net-web-application.aspx it appears wanna this: var user = username; (username comes app) if(user.isinrole(windowsbuiltinrole.administrator)){ //user exists } but how authenticate password ? confused.

mysql - SQL query with joins and optional matching -

i programming mapper info out of database. here database: spel( id, naam) spelbord(id, spel_id, level) fk spel_id --> id in spel veld(spelbord_id, posx, posy, veldnr, istarget, toegang) fk spelbord_id --> id in spelbord entiteit(spelbord_id, posx, posy, entiteitnr) fk spelbord_id --> spelbord_id in veld fk posx --> posx in veld fk posy --> posy in veld so query give me: posx, posy, veldnr, toegang, istarget (and entiteitnr if exists) of each veld. for example: 1, 2, 1, true, false, 1 (there entiteit on veld), or 1, 3, 1, true, false, null (there no entiteit on veld). this query doesn't seem work select v.posx, v.posy, v.veldnr, v.toegang, v.istarget, i.entiteitnr spel s join spelbord sb on sb.spel_id = s.id join veld v on sb.id = v.spelbord_id join entiteit on v.posx = i.veld_posx , v.posy = i.veld_posy order posx,posy with query i'm getting output there indeed entiteit connect it. what need change rows there no enti...

Google Analytics Charts in javascript -

good morning. newbie in javascript, , think want easy, don´t know how. i'm trying draw google analytics graph display on own dashboard. code works, have several webs registered, , shows me same default unless change manually(the field called property). default web another. here code (i have changed client id 'xxx' <html> <head> <title> google analytics charts </title> </head> <body> <p align="center"><b><u>visits<u> </b></p> <!-- step 1: create containing elements. --> <section id="auth-button" hidden></section> <section id="view-selector"></section> <section id="timeline" class="left clear"></section> <section id="pie" class="right"></section> <section id="table" class="left clear"></section> <section id="gauge" class="r...

ios - JSON string becomes different value when converting to float -

i'm parsing weather json local file. "temp_f":40.1, "temp_c":4.5, the problem when parse c value nslog(@"%f", [weatherdict[@"temp_f"]floatvalue]); //logs: 40.099998 if log string value returns 40.1 . nslog(@"%@", [weatherdict objectforkey:@"temp_f"]); //logs: 40.1 the problem seems when calling floatvalue any ideas why happening? you asking "why". the complete answer found in famous article "what every computer scientist should know floating-point arithmetic": http://docs.oracle.com/cd/e19957-01/806-3568/ncg_goldberg.html it must read unless want forever guessing why strange things happen numbers. btw. use double, not float, unless can give me reason why float better you.

visual studio - trying to use regular expression to surround my text with double quotes -

the following small scale example. how use search , replace (regular expression option) surround each line double quotes in visual studio 2012 search , replace? list item item 1 item 2 end list item "list item" "item 1" "item 2" "end list item" i agree, vs find & replace regexes pretty confusing. let's start. need surround text of each line quotes, leading spaces outside of quotes. so need create first group catch leading whitespaces , tabs, , second 1 catch every word , space until end of line, , catch nothing if line empty. then replace first group, quote char, second group, , quote char. regex translation: find: ([\t ]*)([\w ]+) replace by: $1"$2"

jquery - SQLIte insertion looping trough text -

hi trying import pieces of long text sqlite table have following problem. i use bellow code in order read long text stored in test db. var mycollectoridlength = 0, mybill, line = 0; notesdb.transaction(function(t) { t.executesql('select * billtest;', [], function(t, bulkdata){ mybill = bulkdata.rows.item(0); and loop through long text , try insert pieces of db. for (i = 1; <= ((mybill.testtext.length)/126); += 1) { alert(line) // alerts 1, 126, 252 ... t.executesql('insert or ignore buildings (buildingcode, buildingaddress, buildingcollect, buildingpay) values (?,?,?,?);', [mybill.testtext.substr((line+0), 5).trim(), mybill.testtext.substr((line+44), 40).trim(), 0, 0], function(){ alert(line) // alerts 10962 (87 * 126) }); line = * 126; } but line inside executesql not sync loop. sqlite insertion executed after loop. how can solve it???

jsf - pe:triStateCheckbox doesn't work with p:ajax -

i'm using pf 5.1 + pf extensions 3.0.0 + omnifaces 1.8.1 on 8.0.0.10 trying make following example here <pe:tristatecheckbox/> listener not called when change state of component, neither error given. this code of jsf page: <pe:tristatecheckbox style="vertical-align:middle;" value="#{bean.notification}"> <p:ajax listener="#{bean.togglenotification}"/> </pe:tristatecheckbox> and bean: private int notification; public void togglenotification() { system.out.println("toggle"); } //getters , setters what may doing wrong? thank you. ok, code in showcase not same code in real world. went github need specify event name: <pe:tristatecheckbox id="ajaxtristate" value="#{tristatecheckboxcontroller.value2}"> <p:ajax event="change" update="growl" listener="#{tristatecheckboxcontroller.addmessage}"/...

performance - Should I replace Android Activities by Fragments? -

i have large android game in there activity each logical screen. (splash screen, start screen, level chooser, game screen , settings distinct activities). working fine right now. if rewrite there 1 activity , logical screens fragments, reduce ram or cpu consumption? after years (two+) of saying "fragments way go", never replace activities fragments again. using fragments rehuse components fine. using fragments dialogs fine, have realized how awful fragment implementation is, how awful fragment lifecycle , how unpredictable (and buggy) fragmentmanager tends under circumstances. go ahead spend time googling around , find "edge not edge" cases hacks have implemented work around "by design" buggy behavior. sometimes have extend or copy source code of these classes android source code modify private or protected field… don't me wrong, fragments work. not solution problems (they possibly source of new ones in mid-long term). if have act...

php - Laravel query subquery -

for example have 2 queries: 1: $q = somecontent::select('somecontent_id') ->where('slug', request::segment(2)) ->where('something', $something) ->first(); 2 $req = somecontent::select('slug') ->where('something', $anothersomething) ->where('somecontent_id', $q->somecontent_id) ->first(); how merge these 1 query if possible in laravel's query builder? can't find lot using selects statements inside statements. you can union them together, like // query builder provides quick way "union" 2 queries together: $q = somecontent::select('somecontent_id') ->where('slug', request::segment(2)) ->where('something', $something); $req = somecontent::select('slug') ->where('something', $anothersomething) ->where('somecontent_id', $q->somecontent_id) ->union($q)->get();

php - How to format a session variable in a bracket part -

i use tablesorter. in page before set session cookie. tablesorter has part: $.tablesorter.setfilters( table, ['', 'test' ], true); now need session variable word 'test' is, don't know how format it... is this: $.tablesorter.setfilters( table, ['', ($_session["favcoloor"]) ], true); or this: $.tablesorter.setfilters( table, ['', '($_session["favcoloor"])' ], true); or this: $.tablesorter.setfilters( table, ['', $_session["favcoloor"] ], true); or $.tablesorter.setfilters( table, ['', "$_session["favcoloor"]" ], true); i can not work, please me correct formatting. you need echo session variable php jquery code :) $.tablesorter.setfilters( table, ['', '<?php echo $_session["favcoloor"]; ?>' ], true); if php shorthand tags enabled, can use this: $.tablesorter.setfilters( table, ['...

ios - How to run Objective-C file in the beginning of Swift project -

i trying use objective-c in swift project.i want use this library of objective-c in swift.i imported library in swift project.i want library run in beginning when build project,but when build project,viewcontroller.swift being run.so,how run library in beginning? in objective c can have class +(void)load method... run early, maybe before set up... can investigate constructor attribute.

c# - optional parameter: reversed precedence if override of overload exists -

Image
i wonder following behavior: public class { public virtual void do() { console.writeline("a"); } } public class b : { public override void do() { console.writeline("b override"); } public void do(int value = 0) { console.writeline("b overload"); } } class program { public static void main() { new b().do(); // ---> console: "b overload" } } i expect overload exact signature has precedence on overload optional parameters: expect "b override" in console. instead program writes "b overload" console. even resharper fails , falls trap: ... resharper says overload optional parameter hidden overload exact signature, in fact contrary. now, if remove inheritance, behaves expected , resharper warning legitimate: public class b { public virtual void do() { console.writeline("b override"); } public void do(int value = 0) { console.writeline("b overload"); } } c...

php - How to add an editable accordion in WordPress -

i trying add accordion page in wordpress. the issue being, need accordion editable cms, , if possible, user add accordion on different posts. i have looked it, , found advanced custom fields repeater might way go, yet find read on how implement this. any great. i use advanced custom fields repeater similar, , give users ability enter content can repeated. valuable because can wrap each part in html , whole thing can wrapped, let accordion. here repeater code, mine events. if (get_field('monthly_events')){ $events = get_field('monthly_events'); foreach($events $event) { ?> <li> <strong><?php echo $event['event_name']; ?></strong> <p><?php echo $event['event_description']; ?></p> </li> <?php } } you should read instructions. have create , name fields using interface, apply new post type, , put accordion html ...

javascript - Is jquery.load() always considered cross site, even if the resource is local? -

i working on project based on ucdavis wayfinding library . have noticed unable load index.html page in browser if open file. whenever open file url like: file:///c:/some/folders/here/index.html i see error in js console: xmlhttprequest cannot load file:///c:/some/folders/here/demo_map_2.svg. cross origin requests supported protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. i understand error telling me. , sure enough if throw project dropbox , access via public http link works fine. the part don't though why considered cross origin request when svg file stored locally, right alongside html file? is there way other hosting file under sort of webserver (or similar service dropbox) .load() function resolve on resource local same directory html file?

web services - What is the reason of java.lang.reflect.InvocationTargetException when calling a SOAP WS? -

i tryig understand soap ws. write simple classes follow. when deploy application in glassfish , test it, server returns java.lang.reflect.invocationtargetexception. can problem is? @webservice public class authorws { authorservice authorservice = new authorservice(); @webmethod public author getauthorbyid(int authorid) { return authorservice.getauthorbyid(authorid); } @webmethod public arraylist<author> getallauthors() { return authorservice.getallauthors(); } } service class: public class authorservice { authordao authordao = new authordao(); public author getauthorbyid(int authorid){ return authordao.getauthorbyid(authorid); } public arraylist<author> getallauthors(){ return authordao.getallauthors(); } } dao class: public class authordao { public author getauthorbyid(int authorid){ sessionfactory sessionfactory = new configuration().configure().buildsessionfactory(); criteria criteria = sessionfactory.opensession().createcriteria...

Using custom user instead of ASP.NET IdentityUser -

i'm new on asp.net identity , trying customize identity provided while creating new mvc project. asp.net identity automatically creates few tables handle authentication , authorization itself. my main goal create users table others. i've tried following code prevent creating these tables: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.ignore<identityuserrole>(); modelbuilder.ignore<identityuserclaim>(); modelbuilder.ignore<identityrole>(); } when want create user, following error returning: the navigation property 'roles' not declared property on type 'applicationuser'. verify has not been explicitly excluded model , valid navigation property. i found built-in identity user has following structure: identityuser<string, identityuserlogin, identityuserrole, identityuserclaim>, iuser, iuser<string> what n...

XML operation in ColdFusion -

i have problem xml, in case receive xml data. want delete it, because crashes result. <a:exceptioninformation> <a:exceptioninformation> <a:description>xxx</a:description> <a:exceptiontype>yyy</a:exceptiontype> </a:exceptioninformation> </a:exceptioninformation> <a:exceptioninformation> <a:exceptioninformation> <a:description>aaa</a:description> <a:exceptiontype>yyy</a:exceptiontype> </a:exceptioninformation> </a:exceptioninformation> i want find node exceptiontype == yyy , delete all: <a:exceptioninformation> <a:exceptioninformation> <a:description>aaa</a:description> <a:exceptiontype>yyy</a:exceptiontype> </a:exceptioninformation> </a:exceptioninformation>

wordpress - CSS issue with created triangle and background overlap -

i trying make custom element on wordpress website. 1 of downward pointing triangles leading next page section, has number on top of it. my problem way have now, number becomes hidden behind background of section above, , can't number/text remain ontop, exacerbated when seen via mobile. changing z-index didn't help. this css using: /**to create triangle in middle of page **/ div.arrow-down-tan { width: 0; height: 0; border-left: 55px solid transparent; border-right: 55px solid transparent; border-top: 35px solid #f6f6f6; position: relative; left: 50%; margin-left: -55px; margin-top: -3%; padding: 0; z-index: 2; } /**to create text ontop of triangle **/ div.arrow-text { position: absolute; left: 50%; margin-left: -1.25%; top: -8%; color: grey; font-size: 20px; z-index: 10; } and html using (raw html within wordpress visual composer page section - may part of problem since preceding page section's background covering number)...

java - Multiple @RequestMapping (value, method pairs) in Spring MVC -

i achieve spring mvc @requestmapping(value = "/user/{userid}", method = requestmethod.delete) @requestmapping(value = "/user/{userid}/delete", method = requestmethod.post) public void deleteuser(@pathvariable string userid) { ... } this give me common endpoint rest calls , standard html form posts. possible spring mvc? can come is @requestmapping(value = { "/user/{userid}", "/user/{userid}/delete"}, method = {requestmethod.delete, requestmethod.post}) public void deleteuser(@pathvariable string userid) { ... } but result different because post "/user/{userid}" delete user. one thing make 2 separate methods own requestmapping annotation, , pass parameters on different method, actual stuff: @requestmapping(value = "/user/{userid}/delete", method = requestmethod.post) public void deleteuserpost(@pathvariable string userid) { deleteuser(userid); } @requestmapping(value = "/user/{userid}...

git - Overwrite index file in /var/www with vcsrepo -

i trying make puppet module overwrite default index.file (which comes apaceh2) in /var/www/ index file have in git repository. using puppet plugin vcsrepo clone repository. vcsrepo { "/var/www/": provider => git, source => "git@git.*****/testing.git", identity => '/root/.ssh/id_rsa', require => package['git'], } i right getting error: error: /stage[main]/web::repository/vcsrepo[/var/www/]: not evaluate: undefined method `include?' nil:nilclass i have tried force=>"true" , without managing solve problem. the easiest way of doing clone git repository location, , use file resource make index.file either copy or symlink version in checkout. vcsrepo { "/tmp/apacherepo": provider => git, source => "git@git.*****/testing.git", identity => '/root/.ssh/id_rsa', require => package[...

ios - Provisioning profile use existing certificate doesn't work -

i want use push notifications. what have done far: - generated app id - enabled push notification app id - generated development certificate push notification now want generate provisioning profil. can see generated certificate in member center, can't use generate promising profile. wants me generate new certificate. can't select existing one... do know why? the certificate generated not intended generating provisioning profiles, authenticating push server apple's push notification service (apns). you need regenerate current development provisioning profile pick development push notification entitlement (even may not necessary!). the same applies production push certificates , provisioning profiles.

wso2 - How to keep the end point state active permanently irrespective of the end point is up or down? -

how keep end point state active permanently irrespective of end point or down. if timeout occurs endpoint suspended 30000ms(defualt).so in suspension time if request endpoint comes, esb ignore request.so disabling endpoint suspension keep endoint state active always. check post[1] on how disable suspension time. http://miyurudw.blogspot.com/2012/02/disable-suspension-of-wso2-esb-synapse.html

java - Spring Integration Aggregator -

i want use aggregator create message out of 2 messages, i'm not sure how this. at moment i'm reading in 2 files directory , want aggregate messages one. my whole project looks this: read in .zip -> pass custom message handler unzips directory -> read files directory -> try aggregate them it great if send message 2 payloads after unzipping file, aggregating after reading suffice. my unzipper looks this: public class ziphandler extends abstractmessagehandler { file dat; file json; @override protected void handlemessageinternal(message<?> message) throws exception { byte[] buffer = new byte[1024]; try { file file = (file) message.getpayload(); zipfile zip = new zipfile(file); (enumeration<? extends zipentry> entries = zip.entries(); entries .hasmoreelements();) { zipentry ze = entries.nextelement(); string name = ze.getname(); if (name.endswith(".dat...

javascript - Set focus to end of string in div -

i have div attribute contenteditable , want cut content that's input , longer e.g. 5 chars. focus set start of input time... var maxlength = 5; $(".test").attr("contenteditable", function(){ $(this).on('keyup', function( e ){ if( $(this).html().length > (maxlength)){ var content = $(this).html(); content = content.substring(0,(maxlength)); $(this).html(content).focus(); } }); return true; }); div{ width: 100px; height: 20px; background: red; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="test"></div> how can set cursor end of div content? i found samples here in did not work construct. i have tried .focus() , .blur() before , cleared content... no results... of course don't want install plugin... my solution: $...

cordova - how to check file is exist or not in mobile sd card using javascript -

how check if excel file (.xlsx) exists on sd card on android using phonegap? if file exits, how import , export file contents through javascript? first add cordova file plugin project.then use following code : var reader = new filereader(); var filesource = <file path>; reader.onloadend = function(evt) { if(evt.target.result != null) { // if receive not null value file exists } else { // otherwise file doesn't exists } }; // going check if file exists reader.readasdataurl(filesource);

Installing MySQL Connector/C++ or MySQL++ on windows -

i've been trying hours either of these working , linked in visual studio (2012 express version) there no consistency installation instructions. site 1 , site 2 , site 3 , site 4 , site 5 , site 6 . it infuriating least. these folders exist when don't, other mention dependencies others not, include these directories , others include those; ridiculous how hard is. does know how install mysql/c++ library? , able give clear instructions on how so? because, me @ least, answer far no.