Posts

Showing posts from April, 2011

sql - Make Update with select statement in Mysql -

i trying update products category in database. error , and dont understand statement wrong. please help. find products have in name specific word , after update category products. i want select ids sho_posts sho_posts.post_title contain part of word '%audio cd%' , after update sho_term_relationships.term_taxonomy_id value 2 sho_term_relationships.object_id=sho_posts.id update sho_term_relationships set term_taxonomy_id = 2 object_id = (select `id` `1876522_shoping`.`sho_posts` convert(`post_title` using utf8) '%audio cd%') in clause, find ids update based on subquery results, use in instead of = update sho_term_relationships set term_taxonomy_id = 2 object_id in ( select `id` `1876522_shoping`.`sho_posts` convert(`post_title` using utf8) '%audio cd%') you use = if subquery return single row, won't work if subquery returns multiple rows. using in tests whether object id included in subquery results.

javascript - Angularjs with bootstrap Modal -

i using plain angularjs bootstrap. trying create page user lands after login. so deafult route "/" user lands landing.html landing.html contains <ul class="nav nav-pills"> <li role="presentation" class="active"><a href="#/landing">home</a></li> <li role="presentation"><a href="#/tags">tags</a></li> <li role="presentation"><a href="#/help">help</a></li> </ul> my problem have nav homes tags , . on click selected button background should change. there form home (#/landing) . have problem using ng-swipe any appreciated. controller app.controller('indexctrl', function($scope,$http,$rootscope){ $('#mymodal').modal({ backdrop: 'static', keyboard: false }); $(".nav a").on("click", function(){ $(".nav").find("...

c - Does int 80h interrupt a kernel process? -

first background knowledge, book: linux system programming: talking directly kernel , c library signals mechanism one-way asynchronous notifications. signal may sent kernel process, process process, or process itself. the linux kernel implements 30 signals. signals interrupt executing process, causing stop whatever doing , perform predetermined action. ok moving further, here quote part: on intel family of microprocessors, such pentium, int 80h assembly language op code interrupt 80h. syscall interrupt on typical intel-based unix system, such freebsd. allows application programmers obtain system services unix kernel. i can not quite make connection in head really. when example use write method defined in posix , , when compiled assembly, , further assembled object code , linked executable in given architecture runs linux.... system call made right? i assuming compiled code this: mov eax,4 ;code system_write mov ebx,1 ;standard ou...

javascript - Make a NG-Options value select in same function as populating list -

i having difficulties selecting value array in same function populate select using ng-options. trying dynamically load select list full of options , @ same time there default value last time user chose want selected. when console.logging can see works , added machineprofile.input select not reflect ng-model has current value. did confirm both same. have code below. $scope.getmachineprofile = function(object) { var count = 0; var keepgoing = true; $scope.machineprofile.machinename = object.name; $scope.machineinputs = object.hardware; /*angular.foreach(object.hardware, function(inputs, key) { console.log($scope.machineinputs); });*/ //var foundmachine = 0; angular.foreach($scope.machineprofiles, function(machine, key) { if (keepgoing) { if (machine.remoteaddr === object.address) { keepgoing = false; /*$timeout(function(){ }, 500);*/ /*console.log($scope.machineprofiles[count].inpu...

html - Send Ruby Data to Javascript in a Sinatra App -

i wondering how can send data sinatra app javascript. right now, able send data web page through erb file. however, trying present data better requires information go through js , not sure how that. <!-- language: lang-js --> $(function() { var data = [{ label: "chrome", data: 40 }, { label: "safari", data: 35 }, { label: "mozilla", data: 15 }, { label: "firefox", data: 10 }]; var plotobj = $.plot($("#flot-pie-chart"), data, { series: { pie: { show: true } }, grid: { hoverable: true }, tooltip: true, tooltipopts: { content: "%p.0%, %s", // show percentages, rounding 2 decimal places shifts: { x: 20, y: 0 }, defaulttheme: false } }); }); how pass ruby js object , render on our html? you can set variable in ruby ( rubyvarname = somevalue ) , access se...

python - wxPython Acting on Element with Focus -

in program have notebook vertical box sizer buttons next it. buttons performed actions on list box had on frame. moved list boxes tabs of notebook. how can act on elements of tab button not child of notebook sibling. means variable listbox no longer in same scope. this brings me other part of question. if had 2 listboxes side side , buttons, want buttons act on whichever listbox has mouse focus. how achieve this? i assume 2 questions related wrong. want these buttons able act on whatever tab or items selected. a small example wonders me understand element of wxpython. i'm having trouble docs , examples have found far. know has factory i'm not sure how , can't find examples work. i realize think i'm having trouble understanding event argument passed functions bind. how solve issue? how it? thanks this fun little exercise. want traverse widgets of selected tab , check see item selected in listbox. note: mentioned in comment question, pr...

How to install plugins in video.js -

i not developer asking patient me, patient ;) . cannot understand how can install plugins video.js ! upload .css , .js files on plugin folder of site. include code on page of site want place video.? particulary interested in resolution plugin. understood upload 2 files ( .css , .js ) , put piece of code in page want make video appear. nothing happens :(. help!

go - Golang JSON RawMessage literal -

is possible create json.rawmessage literal in golang? i want able this: type errormessage struct { timestamp string message json.rawmessage } func gettestdata() errormessage { return errormessage{ timestamp: "test-time", message: "{}" } } or that. this succinct i've seen. have not been able find example of "struct" literal creating raw json messages. the underlying data type json.rawmessage []byte you can convert string, or use byte slice directly in literal msg := errormessage{ timestamp: "test-time", message: []byte("{}"), } note marshal expected, need use *json.rawmessage , can't take address of in literal context.

spring - LazyInitializationException while updating Entity in database -

i have 3 entities employee, person , emailadress given below: @entity public class employee { private person person; //other data members @manytoone(fetch=fetchtype.lazy, cascade = cascadetype.merge) @joincolumn(name="person_id") public partner getperson() { return person; } //other getter , setters } @entity public class person { private set<emailaddress> emails; //other data members @onetomany(fetch=fetchtype.lazy, mappedby="person", cascade=cascadetype.all) public set<emailaddress> getemails() { return emails; } public void setemails(set<emailaddress> emails) { this.emails = emails; for(emailaddress email : this.emails) { email.setperson(this); } } //other getter , setters } @entity public class emailaddress { private person person; private string email; private string emailtype; //getter , setter @ma...

cakephp 3.0 same controller name for admin and users -

i using cakephp 3.0 , want write admin actions , users actions in users controller. admin actions should accessible admin routing , user actions should accessible without admin routing i know in cakephp 3.0 admin, users controller should in src/controller/admin/userscontroller.php and normal users, users controller should in src/controller/userscontroller.php now confusion is, correct put same controller name in 2 different directories or missing something? thanks in advance. since access point difference /src/controller/admin/controllername , /src/controller/controllername can use both controllername , actionname remaining same. suppose want make userscontroller in both admin , public section. want make actionname in controller. like: //name in admin directory /src/controller/admin/userscontroller.php public function index() { $this->layout = 'admin_default'; $this->set('users', $this->paginate($this->users)); $this...

c++ - How do I invert an affine transformation with translation, rotation, and scaling? -

i have 4x4 matrix translation, rotation, , scaling components, no shear or other transformations. how find inverse? i'm using eigen library in c++. this tricky right, since operations need performed in correct order: template<class derived> matrix4f affineinverse(const eigen::matrixbase<derived>& mat) { matrix3f rotsclinv = ( mat.block<3, 3>(0, 0).array().rowwise() / mat.block<3, 3>(0, 0).colwise().squarednorm().array() //scaling ).transpose(); //rotation return (matrix4f(4,4) << rotsclinv , -rotsclinv * mat.block<3, 1>(0, 3) //translation , 0, 0, 0, 1).finished(); } as this answer states, inverse of top left 3x3 block can calculated separately: inv ([ b ]) = [inv(a) -inv(a)*b] ([ 0 1 ]) [ 0 1 ] the key insight top left block scaling , rotation equal orthogonal (rotation) matrix q times diagonal (scaling) matrix d : q*d . invert it, linear algebra: i...

c# - Dynamic Linq select first in groups after GroupBy -

i think i've read every post on subject still can't seem work. want duplicate following groupby dynamic linq. i've tried dynamic groupby can't seem first(). var result = mydata .groupby(g => g.id) .select(z => z.first()) .select("new (id, field1, field2)"); the groupby needs dynamic. need first row of grouped field. so.. id:1, field1:w, field2:l id:1, field1:a, field2:b id:2, field1:a, field2:b id:2, field1:c, field2:d should end being: id:1, field1:w, field2:l id:2, field1:a, field2:b or id:1, field1:a, field2:b id:2, field1:c, field2:d i solved adding dynamicqueryable public static object first(this iqueryable source) { if (source == null) throw new argumentnullexception("source"); return source.provider.execute( expression.call( typeof(queryable), "first", new type[] { source.elementtype }, ...

Python http get - cannot replicate a curl request with headers -

i have following curl command: curl -h "user-agent: mozilla/5.0 (windows nt 6.1; wow64; rv:38.0) gecko/20100101 firefox/38.0" -h "accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -h "connection: keep-alive" -x http://example.com/en/number/111555000 unfortunately not able replicate it... tried with: url = http://example.com/en/number/111555000 headers = {'user-agent':'mozilla/5.0 (windows nt 6.1; wow64; rv:38.0) gecko/20100101 firefox/38.0', 'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'connection':'keep-alive',} req = urllib2.request(url, none, headers) resp = urllib2.urlopen(req) print resp.read() but server recognized how request "fake" , forwards me google (reply server is: http/1.1 301 moved permanently ). curl instead receive original page. any ideas or suggestions? thank dk edit: additional infos: $ nc exam...

php - Trying to create a function using mysql_fetch_array -

my aim send pushbullet notifications users using cron. i have mysql db , there users table , issues table in it. want users users table after create query bring issue count based on assigned user id issues table. make notifications. here details , tried. firstly; tried user ids , worked expected. function some_function($sa){ foreach($sa $s) echo $s; } $sqltext['id']="select users.id, users.login users group users.login"; $sqlquery_mainmenu = mysql_db_query($db, $sqltext['id'], $connection) or die("error"); $file_names=array(); while($mm_content=mysql_fetch_array($sqlquery_mainmenu)){ $users[]=$mm_content["id"]; } foreach ($users $user) { $foo=array($user); some_function($foo); } since have user ids tried create new query brings issue count based on user id. not it. know want not know how it. $sqltext['push...

string - python appending lists, saving as text, and losing "\t"format -

i have code after every loop iteration appends line of results list. results correspond people (lets "bill") , bill ends list (statsg) of size 3 results. use np.reshape (gives string624 of size (1,3)) when save statsg txt file 1 line (bill 1 2 3 4). within larger loop iterates through patients (lets "bill","jane", "susan"). want append each patient's info form can save readable text file (bill 1 2 3 4 susan 1 5 2 6 jane 5 2 6 7) the code (which i've tried writing 50 different way) gives me great looking statsg file, globalstats file has each line bracketed [['text']] , tabs ("\t") stay \t [['blahblah\tblahblah]]. i'm changing type lot i'm sure thats screwing up. thoughts? statsg.append(str(diameter_glob[1]-diameter_glob[0])+"\t"+str(100*(diameter_glob[1]-diameter_glob[0])/diameter_glob[1])+"\t"+str(pval[1])) statsg2=np.reshape(statsg,(1,3)) np.savetxt(path+'stats...

Sybase large update in batch -

i need large update in sybase. table1 has column a, b, c, e, f, around 9 million records. table2 has column a, e, f, around 500000 records. the bellow update sql failed due syslog full update table1 set e = table2.e, f = table2.f table1, table2 table1.a = table2.a after doing research in internet, bellow 2 procedures still failed due same error did update 5000 records successfully. any ideas. thank you! set rowcount 5000 while (1=1) begin update table1 set e = table2.e, f = table2.f table1, table2 table1.a = table2.a if @@rowcount != 5000 break end set rowcount 0 declare @errorstatus int, @rowsprocessed int set rowcount 5000 select @rowsprocessed = 1 while (@rowsprocessed != 0) begin begin tran update table1 set e = table2.e, f = table2.f table1, table2 table1.a = table2.a select @rowsprocessed = @@rowcount, @errorstatus = @@error if (@errorstatus != 0) begin --raiserror .... rollback tran --return -1...

ios - Apple Watch Show Short or Long Look Notification for UILocalNotification -

i show short-look or long-look interfaces created apple watch app. what works following: the app background job , notifies user. happens uilocalnotification. when iphone locked , watch around arm, watch vibrate , show simple notification, not long or short-look notification. i saw got working push notifications -> apple watch: dynamic long not shown, when push opened notification center app not support push. does know way present long or short-look notifications without server push stuff? i send notification following code: var localnotification = uilocalnotification() //---the message display alert--- localnotification.alertbody = "you have entered region monitoring" //---uses default sound--- localnotification.soundname = uilocalnotificationdefaultsoundname //---title button display--- localnotification.alertaction = "details" //---display notification--- uiapplication.sharedapplication().presentlo...

c# - no templates for ADO.NET in visual studio 2015 rc -

Image
i learning asp.net 5 , mvc 6! created web project like picture after right clicked on models folder -> add new item there no ado.net templates here ( in vs 2013 exist ). here picture : problem web project, created windows application , added new item there ado.net templates. here picture : how fix problem ? anyone having same problem on kind of project (like case) , unable open existing edmx, careful when install vs 2015, , make sure check box saying "microsoft sql server data tools". i had not (we use mysql), , required entity framework designer, whatever connector you're using.

git - Can I add additional references in an existing repo? -

git clone has --reference <repository> option sets sort of cache can used store objects not need copied newly created repo. file .git/objects/info/alternates created lists referenced repository directory. i tried , able specify multiple "references" while cloning , created 2 lines in .git/objects/info/alternates file. my question: there command add references in existing repository @ point after cloning. example, via command git remote reference <repo> . and, if not, possible hand-edit .../alternates file achieve same results?

php - Cannot update Account via Salesforce API -

i'm trying update record via salesforce api (enterprise wsdl). code works without exception, , result salesforce says success. when go salesforce, last modified indicates script did updated record. however, field wanted update not getting updated. sure it's stupid. me point out, please? $client = $builder->build(); $results = $client->query("select id, issuer__c, expiry_date__c, bond_premium__c account new_group_reference__c = '$groupref' limit 1"); $array = array(); foreach ($results $account) { //$account->issuer__c = $info['issuer']; $account->expiry_date__c = $info['expirydate']; //$account->bond_premium__c = $info['bondpremium']; $array[] = $account; var_dump($array); echo 'account: '.$account->id."\n"; } $result = $client->update($array, 'account'); var_dump($result); result: array(1) { [0]=> ob...

azure - manage.windowsazure.com user experience issues -

what missing causing issues accessing " https://manage.windowsazure.com " or " https://portal.azure.com " my problem trying access either of these sites ie 11 on windows 8.1. running vm in vmware fusion. if try open ie normal session , go portal site url. ../sigin/index , white page, nothing else happens @ all. if try access manage site able "all items" view shown message "you have signed out elsewhere. click ok log out management portal" can around hitting escape. i've tried deleting temporary internet files , cookies no avail. if try opening ie in private session , go portal.azure.com able portal , can manage.windowsazure.com page, information not load/refresh. i.e. morning when logged in in, , tried delete several of resources. webpage said doing something, never seemed process. logging in now, none of resources load (just progress bars of them. now if open these same sites in safari on host computer management experien...

python - How do I create a url in django and capture inputs for a search page? -

new django , programming. i want create search page , have following. my urlpatterns has following 1 of it's patterns. url(r'^search/$', view=search, name='search') my views has function def search(request): if request.get.get('q'): message = 'you submitted: %r' % request.get['q'] else: message = 'you submitted nothing!' return render(request, 'myapp/search.html', {'message': message}) search.html has <!doctype html> <html> <head> <title>search</title> </head> <body> <h1> search </h1> <form action="/search/" method="get" > <input type="text" name = "q"> <input type="submit"value="search"/> </form> </body> </html> my issue when go "myapp/search" ...

css - What is the default height of <br> elements? -

i'm working web page uses <br> tags spacing , page layout, , want remove these tags , replace them equivalent in css make page more accessible screen readers. as part of process, need replace break tags used spacing css-based padding. could tell me default line break height can set padding equal height , save lot of time? a <br> element represents line break. height of line break determined current line height of portion of document break element in. the default line height depends on number of factors, including browser you're using , current font family. can find exact computed line height given element in chrome inspecting element, switching computed style tab, , filtering line-height property. in browsers, should able approximate height length value of around 1.2em . more on em units, see section on relative length units mdn.

install nopcommerce with oracle -

hello downloaded solution nopcommerce e-commerce open source achievement operate , install without problems mssqlserver database implement oracledatabase official site http://www.nopcommerce.com/ i have been guiding me post http://www.nopcommerce.com/boards/t/17712/mysql-support.aspx i have tried follow steps indicated mysql , adapt oracle yet 1 of first things tells me creation of 2 classes oracleconnectionfactory: using system; using system.collections.generic; using system.linq; using system.text; using system.data.entity.infrastructure; using system.data.common; using oracle.dataaccess.client; namespace nop.data { public class oracleconnectionfactory : idbconnectionfactory { private readonly string _baseconnectionstring; private func<string, dbproviderfactory> _providerfactorycreator; public oracleconnectionfactory() { } public oracleconnectionfactory(string baseconnectionstring) { this._baseconnectionstring = baseconne...

windows runtime - Change language of WinRT MapControl -

i using winrt mapscontrol in universal application, belongs 'windows.ui.xaml.controls.maps'. want change language of maps when application language changed. i see language property in there (inherited frameworkelement), tried setting language = "ar-sa" in xaml , through code, did not work. tried searching in this documentation well, couldn't myself.

c++ - Would GNU Make automatically add extra prerequisite? -

the following example snippet "managing projects gnu make(3rd edition)" p.21. count_words: counter.o lexer.o -lfl the author says make automatically add count_words.o prerequisite list implicit rule. quoted: ..., make identifies 4 prerequisites: count_words.o (this prerequisite missing makefile, provided implicit rule), counter.o, lexer.o, , -lfl. however, test doesn't conform that. here test: prog: abc.o @echo $^ abc.o: @echo abc.o built. prog.o: @echo prog.o bulit. the output after running make is: abc.o built. abc.o make didn't seek prog.o target prog . what's problem? there wrong test? by way, test on cygwin gnu make 4.1 . you gave recipe prog target. author didn't count_words target. that's difference. the author counting on built in %: %.o rule take effect. overrode rule. remove @echo $^ prog recipe , try again.

ios - How to combine CGRects with each other in Swift -

i wondering if there way combine cgrect cgrect new cgrect. swift have preset functionality or there way of achieving this? let rect1 = cgrect(x: 0, y: 0, width: 100, height: 100) let rect2 = cgrect(x: 40, y: 40, width: 150, height: 150) cgrectunion(rect1, rect2) // {x 0 y 0 w 190 h 190} see more: https://developer.apple.com/documentation/coregraphics/cggeometry https://developer.apple.com/documentation/coregraphics/cgrect https://developer.apple.com/documentation/coregraphics/cgrect/1455837-union

Android: Using SVG in res leads to error: "The file name must end with .xml or .png" -

i updated android studio 1.2.1.1 , gradle got problems svg in resources folder. using svgs no problem , hope "allowed" in future. :app:mergedebugresources :app:mergedebugresources failed /home/petergriffin/folder1/another-app/myawesome-app/app/src/main/res/drawable-hdpi/logo.svg error:error: file name must end .xml or .png error:execution failed task ':app:mergedebugresources'. > /home/petergriffin/folder1/another-app/myawesome-app/app/src/main/res/drawable-hdpi/logo.svg: error: file name must end .xml or .png information:build failed any ideas how solve ? same problem webp files in drawable resource directory. the latest gradle plugin (v1.2.3) not recognizing of image formats used work before. don't have issue when switch v1.2.2 update: given feature fixed, should upgrade latest gradle plugin release instead of reverting back. you can change version in build.gradle setting: buildscript { repositories { jcenter() mavenc...

php - Guzzle send empty array in multipart request -

i using guzzle 6 send multipart form request 3rd party api(cloud foundry). api takes 2 parameters "resources" , "application". here doc call making. in short deploys binary an applications server. below code using in guzzle. getting "invalid resource type" error when trying send empty array contents of "resource" parameter. guzzle seems allow strings here? api requires empty array sent when new binary being pushed. here code: $response = $this->client->put($this->baseurl . "apps/7887990-654e-4516-8ce9-b37bc2f93a87/bits", [ 'multipart' => [ [ 'name' => 'resources', 'contents' => [] ], [ 'name' => 'application', 'contents' => '@/tmp/cfdownloadyqfop7', ] ] ]); the above fails mentioned error, , chang...

Retrieve a value from S4 class output in R -

i writing simulation in r. have decided use s4 class return 2 values in function. when run simulation, wondering how can retrieve values output calculate moments of distribution them such mean? setclass(class="coalescent", representation( tmrca="numeric", t_total="numeric" ) ) the output looks below: > tmrca_sim <-replicate(10000, coalescent_fun(n, ne)) > head(tmrca_sim) [[1]] object of class "coalescent" slot "tmrca": [1] 6.723592 slot "t_total": [1] 9.693661 [[2]] object of class "coalescent" slot "tmrca": [1] 1.592346 slot "t_total": [1] 11.50406 what want extract values of "tmrca" , "t_total" , calculate mean. of course use many other ways simulation want learn use of classes @ same time. you can extract data matrix: mx <- sapply(tmrca_sim, function(x) sapply(slotnames(x), slot, objec...

css - SVG clock hour hand length -

i've been playing round clock on code pen http://codepen.io/knitevision1/pen/qfdne . can me reduce length of hour hand? i've tried altering height seems drawing hand outside in. the piece of code in question is: <div id="clock-container" style="padding-left:180px;"> <font color="white" size="1">&nbsp;&nbsp;&nbsp;london</font> <svg id="clock" viewbox="0 0 100 100"> <circle id="face" cx="50" cy="50" r="45"/> <g id="hands"> <rect id="hour" x="47.5" y="12.5" width="5" height="40" rx="2.5" ry="2.55" /> <rect id="min" x="48.5" y="12.5" width="3" height="40" rx="2" ry="2"/> <line id="sec" x1="50" y1="50" x2="50...

wordpress - 301 redirect with query string - woocommerce products -

here problem i've stalled days. setup wordpress woocommerce installed. permalinks structure works great, need redirect old urls new ones. old url structure looks this: http://domain.tld/?product=bla-bla but need them redirect this: http://domain.tld/product/bla-bla *bla-bla dynamic part. the rule in .htaccess i've made: rewritecond %{query_string} ^product=(.*)$ [nc] rewriterule ^$ /product/%1 [nc,l,r=301] but result partially wrong: http://domain.tld/product/bla-bla?product=bla-bla the contents of .htaccess: rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] rewritecond %{query_string} ^product=(.*)$ [nc] rewriterule ^$ /product/%1 [nc,l,r=301] i appreciate help! have way: rewriteengine on rewritebase / rewritecond %{query_string} ^product=(.*)$ [nc] rewriterule ^$ /product/%1? [nc,l,r=301] rewriterule ^index\.php$ - [l] rewriteco...

c++ - Visual Studio: which source file includes a particular library (with "pragma comment")? -

edit :solved james mcnellis' suggestion, led me offending library. 1 hadn't checked dumpbin. i'm building visual studio 2013 project links against static libraries using "#pragma comment" instead of listing libraries in project properties. after replacing libraries new versions, i'm getting link error because it's still trying find of old libraries, e.g. can't find "library_v9.lib" when should linking "library_v12.lib" instead. how can find old libraries being requested? here's i've tried: deleting objects, etc. , rebuilding scratch. searching "#pragma comment" doesn't work because it's built several layers of macros, , version number obtained _msc_ver "9" , "12" never appear anywhere in source. running dumpbin /directives on libraries linked executable. refer correct "12" library versions. the linker has /verbose switch cause print out detailed log of lib...

Best practice for data version control in sql and c# -

in question want figureout, best practice control versions of data in sql. useing relational database (sybase sap sql anywhere). problem is, don't know in layer of our software should implement version control system. want write generic system, version control available types of data small amout of work every type (types: contacts, appointments, ...). here options figured out: 1. using entity framework , calculating difference of 2 models. saving difference database 2. using triggers , comapre old , new data , save them in separate table 3. using procedures proof changes , save them in separate table i know it's general question, maybe 1 has idea , solution our problem. edit important: want create versions of data itself, not of sql schema or sql code. edit2 lets use following simple example. have tiny contact table (not our real contact table): create table contact ( "guid" uniqueidentifier not null unique, "contactid" bigint not n...

python - Flask-wtf: csrf_token is removed from session before I can POST my form -

i'm using flask flask-security (specifically flask-wtf regarding csrf issue) "ease" process of register/loggin users (not easy far). i'm using backbonejs on front-end, therefore kind of hacked original way use flask-wtf. indeed, make ajax request on /register register page (generated flask-security) , put resulting html in modal. render: function () { var self = this; $.ajax({ type: 'get', url: config.constants.servergateway + "/register" }).done(function(result){ console.log("get register done", result); var html = self.template({ config: config, form: result }); self.$el.html(html); }).fail(function(error){ console.log("could not register token", error); var html = this.errortemplate({ config: config }); self.$el.html(html); }); ...

java - Dynamic call of google analytics methods -

i trying figure out way create dynamic call analytics client data = analytics.data().ga().get(tableid, // table id. startdate, // start date. enddate, // end date. metrics).setdimensions(dimensions).setsort(sort).setfilters(filters) .setsegment(segment).setsamplinglevel("default").setstartindex(1).setmaxresults(1000).setoutput("json") .setfields(fields).execute(); the parameters taken web service call. how make thing dynamic? lets want ommit properties. 1 have clue?i want data = analytics.data().ga().get(tableid, // table id. startdate, // start date. enddate, // end date. metrics).setdimensions(dimensions).setsamplinglevel("default").setstartindex(1).setmaxresults(1000).setoutput("json") ...

sql - Optimize MS Access Double SubQuery -

this ms access query i'm building slow. testing 1 month of data (one table driving query 28,577 records, 36 columns). here trying accomplish: i want return count of unique vehicles model sold in specific transaction type (this database not normalized, , built excel sheet loaded table). the first subquery exists because understanding in access cannot use distinct statement aggregate function. needed build subquery handle count(distinct vin). the second subquery believe culprit. each vin may have many entries. example vehicle might have been sold using 1 of transaction categories counting, cancelled, , resold 1 of transaction categories don't want count. produce 3 records vin: sale transaction category thought wanted count cancel of first sale re-sold a transaction category don't want count the 2nd subquery checks see if vin has "cancelled sale" record , not include first sale in count. hopefully explained well, , can offer me potent...

javascript - What is the meaning of '|e' in RegExp -

in line below, purpose of '|e'? tried looking couldn't find it, , line still it's supposed when isn't there. pattern = /([\+|\-]?[\d]+[\.][\d|\-|e]+)[ ]+([\+|\-]?[\d]+[\.][\d|\-|e]+)[ ]+([\+|\-]?[\d]+[\.][\d|\-|e]+)/g; edit: here sample of code parsing. -3.424999 -0.855454 2.257396 -1.484919 0.665606 -3.151304 1.636841 -0.848154 -0.458954 3.732041 0.187906 -1.319734 -1.756719 0.682006 0.807596 0.911641 -0.828054 3.040696 -0.218059 -0.489374 -3.806524 -1.078099 0.891706 -2.420454 normally, | gives alternative options, (one|two) matches either 1 or two. however putting | inside [] suggests doesn't understand how [] work (they match single instance of character within them - or range, [a-z] matches or b or c... i suspect, unless have | within string matching, can remove of | occurences pattern , still work. it's difficult know more without seeing examples of kind of string should matching, , want capture. (edit) : have...

asp.net mvc 5 - How to create cshtml file automatically? -

i'm using mvc 5 , want create cshtml file automatically forum. i have created page allow user posting new thread. when user submits, data textarea , insert database. have done control. my question is: how create cshtml file load data database , display automatically? example: post new thread title is: here title . when click submit, converted <a href="/newthread/here-is-my-title">here title</a> that mean: controller newthread , view here-is-my-title.cshtml had been created successfully. can tell me how that? p/s: hope question. thank you!!! if u use entity framework model....u dont need create cshtml file ...it created automatically follow steps 1. right click controller 2. goto add controller 3. choose "mvc5 controller views using entity framework" there u can automatically create controller , view

amazon web services - Using the public IP on AWS from java getCanonicalHostName method -

i'm trying use aws scalable analytics tool. i'm using apache zeppelin interactive shell spark cluster , trying plot using wisp. causing problem plotting approach in wisp start web app based on think jetty server. works on local machine on aws not work picks private ip address rather public one. within wisp, uses java.net.inetaddress.getlocalhost.getcanonicalhostname retrieve ip address of machine. returns private fqdn address. how can make java function return public ip address or fqdn aws provides without hardcoding in wisp every time spin cluster , rebuilding? i have tried changing /etc/hosts , /etc/hostname both have no effect. don't know java.net.inetaddress.getlocalhost.getcanonicalhostname getting it's address from. any or advice appreciated. dean i'm idiot. port issue. appears despite displaying private ip, it's still available on public ip. turn off internal firewall sudo ufw disable (on ubuntu vm anyway, alternative command fla...

c# - pictureBox.ImageLocation with asteriks -

i'm considerably new c# , visual studio got stuck on 1 problem. there way make picturebox propertie locate image file? asteriks doesn't seem work.. this.picturebox1.imagelocation = "d:\\*.png"; the directory alawys consists of single .png file, though changes name periodically. you can't use wildcards on picturebox , directory.getfiles support them. use so: string[] files = directory.getfiles(@"d:\", "*.png"); if (files.length > 0) { // file(s) found. can either decide // 1 display or display first // 1 picturebox1.imagelocation = files[0]; } else { // no files found. display default image or }

android - Modeling a mobile app: How to go from the idea and design to classes and objects -

i'm trying develop own application, i'm not bad code (java, objectif c...) nor design (photoshop, illustrator... ). but have same problem, never know how go app sketch , storyboard defining objects , classes in code. makes huge mess in head. i tried looking around sites can find describe processus having idea, creating design, storyboard, coding app, publishing , marketing. none explain how go said storybord code or architectures of code, not solving problem. as time passes gets more annoying, feel stuck :/. can me leads ? pretty please sugar on top :) much insight , understanding can gained apple worldwide developers conference (wwdc) videos . designing great apps highlights videos , guides may helpful. designing intuitive user experiences . learn key concepts , principles enable make app more intuitive , approachable. while 1 specific video may not cover practices you're looking understand, principles , recommendations present set on right ...

php - Why is var_dump((int)(PHP_INT_MAX + 1)) a negative number? -

i pulled result here : and interestingly, result of var_dump((int)(php_int_max + 1)) displayed negative number (in case of specific example, display int(-9223372036854775808) ). again, key here candidate know value displayed negative number. is int negative because adding 1 overflow integer bits , change bit representing sign of int? what's reason?

Second Max in Tableau Calculated Field -

how can second highest value field in calculated field. in excel use large function there doesn't seem tableau equivalent. prefer calculation in tableau instead of using pass through function. here 2 alternatives. first, if want calculation happen on data source side, write lod calculation find max of field, name mymax {fixed [my_dimension1], [my_dimension2] : max(myfield)} whether use fixed, include or exclude scope lod calc depends on how want scope analysis. then write row level returns field value if less lod calc, , implicitly null otherwise, name myfieldexceptmax if myfield < mymax myfield end the max of row level calc answer. max(myfieldexceptmax) alternatively, if want operate on client (tableau) side find penultimate aggregated query result, can use on of ranking table calc functions, , filter show second ranking result.

javascript - Why does myArray.length show up as 0 during debugging? -

Image
i'm stepping through vb.net / asp application when noticed curiosity in javascript function: mouse on array , can see there 7 items in collection. mouse on length property , says 0. why that? length() tends refer contiguous elements - string has length example. count() tends refer number of elements in looser collection.

elasticsearch - From Json String to XContentBuilder -

i have file in json format, there way convert xcontentbuilder? what want read file mapping , convert xcontentbuilder something like: xcontentbuilder builder = jsonxcontent.contentbuilder().source(string json); this seems work me: import static org.elasticsearch.common.xcontent.xcontentfactory.jsonbuilder; import org.elasticsearch.common.xcontent.xcontentbuilder; import org.elasticsearch.common.xcontent.xcontentfactory; import org.elasticsearch.common.xcontent.xcontentparser; import org.elasticsearch.common.xcontent.xcontenttype; ... string message = "{\"bob\": \"test\"}"; xcontentparser parser = xcontentfactory.xcontent(xcontenttype.json).createparser(message.getbytes(); parser.close(); xcontentbuilder builder = jsonbuilder().copycurrentstructure(parser);

php - nested foreach in codeigniter view -

i have 4 tables: process, country, process_country , category. each process belongs category. country may have several processes available , process may available in several countries. below database structure: category table process table country table process_country -------------- -------------- ------------- --------------- categoryid processid countryid countryid categoryname processname countryname processid categoryid countryid i have created functions available processes each country wanted display processes under corresponding categories dont know how implement. able list processes , categories separately don't know how nest them. achieve page list each country: > 1. category 1 > process 1 > process 2 > 2. category 2 > process 3 i thinking nested foreach loop: <?php foreach ($categ...

c# - How can I get my graph updating? -

currently working on project takes cpu temperature , put cool graph. takes first value given stops. doesn't keep updating. have tried while loops not seem work. current code: using system; using system.windows.forms; using system.collections.generic; using system.drawing; using system.drawing.drawing2d; using openhardwaremonitor; using openhardwaremonitor.hardware; namespace pc_version { public class circularprogressbar : control { #region "properties" private color _bordercolor; public color bordercolor { { return _bordercolor; } set { _bordercolor = value; this.invalidate(); } } private color _innercolor; public color innercolor { { return _innercolor; } set { _innercolor = value; this.invalidate(); } } private bool _showpercentage; public bool showpercentage { { return _showpercentag...

awk for loop error when using if else -

here datafile t2, separated tab _ibaseebna1_1 0.79(0.28-2.22) 0.6540 _ibaseebna1_2 0.88(0.48-1.62) 0.6900 _ibaseebna1_3 0.78(0.32-1.86) 0.5700 ptrend 0.93(0.72-1.20) 0.5800 _ibaseebna1_1 1.85(0.60-5.73) 0.2850 _ibaseebna1_2 1.89(0.57-6.27) 0.2950 _ibaseebna1_3 3.21(1.00-10.33) 0.0510 ptrend 1.39(1.05-1.85) 0.0200 pinteraction 1.39(0.93-2.10) 0.1120 i want remove value of second column if $1==ptrend or ==pinteraction. the results should like: _ibaseebna1_1 0.79(0.28-2.22) 0.6540 _ibaseebna1_2 0.88(0.48-1.62) 0.6900 _ibaseebna1_3 0.78(0.32-1.86) 0.5700 ptrend 0.5800 _ibaseebna1_1 1.85(0.60-5.73) 0.2850 _ibaseebna1_2 1.89(0.57-6.27) 0.2950 _ibaseebna1_3 3.21(1.00-10.33) 0.0510 ptrend 0.0200 pinteraction 0.1120 i can use code : awk -f' ' ' { if ( $1=="ptrend" ) print $1," "," ",$3; else if ( $1=="pinteraction" ) print $1," "," ",$3; ...

multithreading - Java multi threading executing more than the loop bounds -

i creating web scraper pull both links , emails web. links used find new places search emails , emails stored in set. each link passed fixed thread pool in own thread more emails. started of small looking 10 emails reason code returns 13 emails. while (emailset.size() <= email_max_count) { link = linkstovisit.poll(); linkstovisit.remove(link); linksvisited.add(link); pool.execute(new scraper(link)); } pool.shutdownnow(); emailset.stream().foreach((s) -> { system.out.println(s); }); system.out.println(emailset.size()); while understand possible create threads still running after 10 emails shouldn't pool.shutdownnow() end threads? here thread code if helps. class scraper implements runnable { private string link; scraper(string s) { link = s; } @override public void run() { try { document doc = (document) jsoup.connect(link).get(); ele...