Posts

Showing posts from May, 2015

c# - using typeof() to search for all object -

public class classa { int num = 10; } classa = new classa(); classa b = new classa(); classa c = new classa(); a.gettype(); //we can result "classa" here question. anyway can object of classa using typeof(classa)? or other way? kind help if want get object of classa you may want organize classa instances collection , say, array , use linq : object[] source = new object[] { "string", new classa(), // new object(), new classa(), // , should filtered out null }; ... classa[] result = source .oftype<classa>() .where(item => item != null) // may want filter .toarray();

c++ - Qt and OpenGL: How do we use glu* functions when using QOpenGLFunctions? -

i trying feet wet both opengl , qt (5.6) simultaneously , ran problem. code in c++ on windows if matters. how use glu* functions (say glucylinder ) when using qopenglwidget qopenglfunctions ? can program compile if include <gl/glu.h> , invoke global gl* opengl functions (from gl/gl.h ) , not of qopenglfunctions .

apache - htaccess complex rule for product searcher -

i need create complex rules product searcher. 3 rules, 4 or more values each. the clean url should this: www.domain.com/products/rule1-value4/rule2-value5/rule3-value2 the orginal url this: www.domain.com/products?rule1[ ]=4&rule2[ ]=5&rule3[ ]=2 of course, combination of policies arbitrary, there aren't 3 htaccess rules should universal. there many possible combinations this: rewriterule ^products/rule1-value3/?$ /products?rule1[]=3 [l] i start create complex rule rewrite each rule , glue url on last line (for 2 rules , 1 value each test). , doesn't work. please help. i'm lame in complicated htaccess rules , regular expresions :) rewriterule ^/products/?(.*)?(rule1-value1)(.*)? %{request_uri}?rule1[]=1 [qsa] rewriterule ^/products/?(.*)?(rule2-value3)(.*)? %{request_uri}?rule2[]=3 [qsa] rewriterule ^/products/^(.*)$ /products$1 [qsa,l]

Batch create folders from files with similar beginning but different ending -

Image
i have lof of files similar beginning names, ending different. have create folder every "series" of files, means files names begin same 7 characers. see image visualization: the code have right is for /f "tokens=*" %%i in ('dir /b *.jpg') md "%%~ni"|copy "%%i" "%%~ni" creates folder every file , puts inside. unfortunately don't have enough knowledge of language , googling made me learn how create substring set _result=%_test:~0,7% not how create folders that. i'm sure it's short sequence, me that? this may not efficient way of doing this, should you. below batch script takes input folder , output folder inputs user. iterates through files in input folder , copies them output folder under sub-folder first 7 characters of filename. @echo off setlocal enabledelayedexpansion rem input directory user set /p input_dir=please enter full path directory files: rem ouput directory user set /p output_

c# - Wrap unknown count of string using replace -

Image
sorry title, had hard time trying summarize this. i'd replace unknown number of instances of string wrapper. i'd replace this: test two:\t\t tab characters with this: test two:<span class="" style="white-space:pre">\t\t</span> tab characters there number of \t characters in given string, , in multiple locations. the reason i'm trying our software uses chilkat sent emails, , if html content contains tabs, these not shown @ receiving end. when sent, use \t represent tab, , when viewing source of received email, tabs there, outside source not: outside source: source: i tested gmail, , wraps tabs: i understand maybe chilkat issue, can't find on topic, if can around above, i'm willing try it. use this using system; using system.collections.generic; using system.linq; using system.text; using system.text.regularexpressions; namespace consoleapplication2 { class program { static v

android - How to POST a Dictionary using @PartMap -

i'm sending post message using retrofit2 upload file plus couple of parameters. of parameters dictionaries. in order this, have following: @multipart @post("incidents") call<machinerequest> sendmachinerequest(@partmap map<string, requestbody> partmap, @part multipartbody.part image; the problem is: seems if can upload strings value parameters only. utilize requestbody create(mediatype contenttype, string content) create entries @partmap map. of course, dictionaries have strings fit in requestbody. leads wrong interpretation in rails backend. values interpreted string , not dictionary. "incident"=>"{\"type\":\"machinerequest\"}" instead of "incident"=>{\"type\":\"machinerequest\"} so question is: how can add dictionary in @partmap, or how can create reqeustbody holds dictionary? even though question downvoted, still believe findings can helpful new retrofit ,

javascript - GetElementById equivalant in angular js -

<div> <input id="txt" type="text" placeholder="choose file" /> <input type="file" id="selectedfile" class="hidden" onchange="changetext(this, 'txt');" /> <span> <button type="button" onclick="document.getelementbyid('selectedfile').click();">browse</button> </span> </div> i want on-click event in angular js. can tell? i want on-click event in angular js. can tell? code in comment okay, before might not have read question fully. have, , think you're looking for: https://plnkr.co/edit/pfju5b17qczwhkog4itn?p=preview .controller('upload', ['$scope', function($scope) { this.input; this.browse = function() { this.input.click(); }; }]) .directive('fileupload', [function() { return { 'restrict':'e', 'controller&

c# - Create a 'Licensing' feature with SQL-Server -

i want implement following interface on 2-tier application ms sql-server 2008r2 (i.e. no app server in between) interface ilicense { void acquire(string license); void release(string license); } however, want release license if application killed or bombs out without calling release method. want avoid using timer refreshes license every minute or so. so thought: use dedicated sqlconnection sp_getapplock , sp_releaseapplock sp because that's seemed made for. found out sp work within transaction, need keep transaction open time (i.e. while application running). anyway, works way. application starts, opens connection, starts transaction, , locks license. when application terminates, connection closed, rolled , license released. super. whenever running app needs switch licenses (e.g. module), calls release on old license , acquire on new one. cool. now question(s): is acceptable have open (uncommitted) transaction open on separate connection long time? are the

algorithm - Proof of Master theorem for Case-1: How these steps are mathematically derived? -

Image
i reading thomas h. cormen book understand proof of master theorem.however, stuck @ proving case-1.please me understand mathematical proofs more easy mathematical derivation of steps in following image: thanks for first question: b^{\log_b(a)} = (don't have tex in so?) this because logarithm base b inverse of b^ . a / = 1 , b^epsilon remains. second , third question: geometric series, can find here: https://en.wikipedia.org/wiki/geometric_series#formula summand b^epsilon must between 0 , 1 (exclusive), i.e. |b^epsilon| < 1 .

html - Show two tables in line to each other within an offset -

Image
i've 2 tables places beneath each other. the second table summary of first 1 , have less columns first. want display second table offset. second table have slight offset, won't display in-line each other. open snippet fullscreen see example. how can fix both tables displayed smoothly? here's screenshot further clarification. i want 2 lines start on same width. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <body> <div class="wrapper"> <div class="page-wrapper"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-12">

c# - Add objects to list in loop in IL Emit - Common Language Runtime detected an invalid program -

the following c# code: list<int> list = new list<int>(); for(int count = 0; count < 5; count++) list.add(count); return list; my corresponding emitted code follows: localbuilder list = ilout.declarelocal(typeof(list<int>)); localbuilder count = ilout.declarelocal(typeof(int)); localbuilder cmpres = ilout.declarelocal(typeof(bool)); constructorinfo dictconstrctor = typeof(list<int>).getconstructor(new type[] { }); methodinfo methodinfo_add = typeof(list<int>).getmethod("add", new[] { typeof(int) }); label il_001c = ilout.definelabel(); label il_000b = ilout.definelabel(); ilout.emit(opcodes.newobj, dictconstrctor); ilout.emit(opcodes.stloc_0, list); ilout.emit(opcodes.ldc_i4_0); ilout.emit(opcodes.stloc_1, count); ilout.emit(opcodes.br_s, il_001c); ilout.marklabel(il_000b); ilout.emit(opcodes.ldloc_0, list); ilout.emit(opcodes.ldloc_1, count); ilout.emit(opcodes.call, methodinfo_add); ilout.emit(opcodes.ldloc_1, count); ilou

geolocation - Android listing large number of data in a listview based on current location -

i trying display large number of records in list view , ordering them base on user location -nearest first- in range of 15km , data keep updating while user move. the current approach doing send request server current location , distance calculation done on server side , data ready use .. but approach take many time application couldn't handle! , application become slaw.. i thought can cash data on mobile , calculate on mobile data huge! how can handle that? idea ? you can use firebase realtime database , , make json details nearest range etc, make priorities in database on how should update using query . if going display large amount of data, should consider moving recyclerview . you can find tutorials on firebase realtime database here

hyperlink - python function that checks link and if its a download only allows it if its less than 5mb -

i using robot framework. trying define keyword accepts argument of link xpath. when receives link click , if download link determine if file size greater argument 2 if file downloading , size greater limit passed cancel download. can click part have no clue how size , if download function , cannot cancel part windows function , i'm doing things selenium webdriver. solution must using python script interrogate file before actions download? since robotframework uses python codig base couldn't command modified include little tweak? when receives link click , if download link... once you've clicked on link, download initiate. it's late determine size (sort of). use head request - requests.head(...) on link href (the url); not get method. 1 of headers should content-length in bytes. if so, can determine if want download file or not. and you'll need use requests library , integrate keyword. or available robotframework-httplibrary .

Python pandas 'ffill' method not working -

in book 'python data analysis' there example using pandas' series data structure reindexing. copied simple code ipython notebook , run not change obj3 . obj3 = series(['blue', 'purple', 'yellow'], index=[0, 2, 4]) print(obj3) obj3.reindex(range(6), method='ffill') print(obj3) in book says output should be: out[85]: 0 blue 1 blue 2 purple 3 purple 4 yellow 5 yellow tried different (supposedly equivalent) method called 'pad' without success. why not working? you need assign obj3 = : obj3 = obj3.reindex(range(6), method='ffill') print(obj3) 0 blue 1 blue 2 purple 3 purple 4 yellow 5 yellow dtype: object

python - REGEX to make string start from specific point -

i have split string using regular expressions: nikolaus kopernikus -> 1473-1543 i tried following, gives me list without -> what need years 1473-1543, preferably in list ['1473','1543'] import re print ( re.split(r'->', 'nikolaus kopernikus -> 1473-1543')) i want regular expression makes string start specific sign, lot in advance! if want use regular expression: import re re.match('.*->[^\d]*(\d+)-(\d+)','nikolaus kopernikus -> 1473-1543').groups() #output: ('1473', '1543') if need list instead of tuple use list function.

python - fail to login to website with request -

at first here code: import requests payload = {'name':'loginname', 'password': 'loginpassword'} requests.post('http://myurl/auth',data=payload,verify=false) rl = requests.get('http://myurl/dashboard',verify=false) print(rl.text) my problem: i status code 200 means login successfull. when try visit protected page http://myurl/dashboard output doesn't fit. shows me first page login , don't why. i know there many questions studied every answer , docs dont it. any nice. drives me cracy. in advance! you need use session object have requests maintain track of cookies, such login cookie set after requests.post login action. quoting the[first example there: s = requests.session() s.get('http://httpbin.org/cookies/set/sessioncookie/123456789') r = s.get('http://httpbin.org/cookies') print(r.text) # '{"cookies": {"sessioncookie": "123456789"}}'

ios - AVPlayerLayer slow instantiation -

note : accept answer in xamarin.ios, objective-c or swift. if need reading xamarin code can clear you, should fine considering "complexity" of code here. i suspect avplayerlayer slow down process. i'm embedding video/audio player in controller of mine, using following code in viewdidload : void setuplayer() { _layer = avplayerlayer.fromplayer(_player); _layer.frame = playerviewcontainer.bounds; _layer.player = _player; _layer.backgroundcolor = uicolor.black.cgcolor; _layer.videogravity = avlayervideogravity.resizeaspect; //this uiview playerviewcontainer.layer.insertsublayer(_layer, 0); } as this, in constructor of own controller (containing player) : public void seturls(string mediaurl, string coverurl = null) { coverurl = string.isnullorempty(coverurl) ? string.empty : coverurl; mediaurl = mediaurl; avurlasset asset = new avurlasset(n

java - Removing Android system overlay activity -

i have activity have set system overlay. i'm able display it, can't seem figure out how remove when want (via button). the system overlay displayed in activity's oncreate() method follows: final windowmanager.layoutparams params = new windowmanager.layoutparams( windowmanager.layoutparams.match_parent, windowmanager.layoutparams.match_parent, windowmanager.layoutparams.type_system_alert, windowmanager.layoutparams.flag_not_touch_modal, pixelformat.opaque); windowmanager wm = (windowmanager)getapplicationcontext().getsystemservice(context.window_service); view mtopview = (viewgroup) getlayoutinflater().inflate(r.layout.overlay, null); getwindow().setattributes(params); wm.addview(mtopview, params); i have button in activity's layout xml file onclick call method dook(view v), following: windowmanager wm = (windowmanager)getapplicationcontext().getsystemservice(context.window_se

haskell - Where is the source of `GHC.Paths.*` value came from? -

i running stack version 1.1.2 x86_64 hpack-0.14.1 $ stack exec ghc run outside project, using implicit global project config using resolver: lts-5.10 implicit global project's config file: /home/wisut/.stack/global-project/stack.yaml /home/wisut/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc but when using stack ghci ghc.paths return wrong path $ stack ghci run outside project, using implicit global project config using resolver: lts-5.10 implicit global project's config file: /home/wisut/.stack/global-project/stack.yaml error parsing targets: specified targets matched no packages. perhaps need run 'stack init'? warning: build failed, optimistically launching ghci anyway configuring ghci following packages: ghci, version 7.10.3: http://www.haskell.org/ghc/ :? ok, modules loaded: none. prelude> ghc.paths.ghc "/usr/bin/ghc-7.10.3" i running arch linux ghc 8.0.1 therefor there no ghc-7 avaliable outside stack [wisut@earth ~]$ ghc /usr/bin/g

angularjs - Error: [$injector:modulerr] Failed to instantiate module ng due to: this is null after upgrading to angular 1.5 -

after upgrading angular 1.5.7 1.4.9, i'm getting following error: i have angularjs last script tag avoid conflicts application code. error: [$injector:modulerr] failed instantiate module ng due to: null $compileprovider@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:7656:3 .bind/<@http://localhost/wro/appjs.js?resource_version=12345-0:23:968 instantiate@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:4724:14 provider@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:4538:1 supportobject/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:4530:16 ngmodule@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:2564:7 invoke@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:4709:16 runinvokequeue@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:4602:11 loadmodules/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js:4611:11 foreach@https://ajax.goog

xcode - Can't delete english UK language in itunesconnect -

Image
i trying send application review in itunesconnect. i have noticed primary language english uk (don't know why). change english , delete english uk. i managed change primary language english us, impossible delete english uk. deleting it, saving , looks okay until refresh page. uk language still there. problem not exist other language (i can add them , remove without problem). may cause issue? you need select english uk top right corner , there able remove it, this: if have selected other language, wont let remove language.

mysql - How can I Insert Data Into a Join Table with a Many to Many Relation Using a Rails Controller Page -

given: 2 tables, lists, , cars, have many many relations. i want append data console. finding , reading browser works, how can add , append through rails controller page? with has_many relationship can add record << @car.lists << @list @list.cars << @car

c++ - In which segment a given number lies in? -

this question has answer here: is floating point math broken? 20 answers suppose have n (integer) contiguous segments of length l (floating point). is: segment 0 = [0, l) segment 1 = [l, 2*l) segment 2 = [2*l, 3*l) ... segment (n-1) = [(n-1)*l, n*l) given number x (floating point) want determine id of segment lies inside. my first idea following: int segmentid = (int) floor(x/l); anyway, not work. example, consider double l = 1.1; double x = 5.5; int segmentid = (int) floor(x/l); //returns 5 double l = 1.1; double x = 6.6; int segmentid = (int) floor(x/l); //returns 5!!! of course, due finite arithmetic, not work well. maybe checks required in order have robust implementation, don't know how proceed further. the question is: how solve problem "in segment given number lies in?" your problem neither 1.1 , nor 6.6 represen

javascript - Lodash split object -

how can use lodash split following object 2 arrays the object {"m": [ "alpha", "beta", "zeta"], "f": [ "alpha", "omega" ]} i want be var first = [ "alpha", "beta", "zeta"] // contents of m var second = [ "alpha", "omega" ] // contents of f is possible in lodash? , if not how possible in vanillajs thanks you don't need lodash this. just: var first = theobject.m; var second = theobject.f; first , second refer arrays in object. if want copy them, then: var first = theobject.m.slice(); var second = theobject.f.slice();

Need to push Data from MongoDB collection to .JSON file using fileSystem -

i have collection in mongodb name "userdata". there 3 records inside it, like: {"_id":objectid("23456"),"username":"abc","password":"xyz","email":"x@y.com"} {"_id":objectid("12345"),"username":"def","password":"asd","email":"a@b.com"} {"_id":objectid("23212"),"username":"qwe","password":"uiw","email":"c@d.com"} i want these data pushed data.json file using filesystem. tried efforts of basic json data pushing approach (counting length of data , looping variable , stringify them) failed. please me out on this. thanks abhijeet

javascript - PHP/HTML button picture change and script call -

i have page buttons user clicks on. when button gets clicked need change image , call php script save change. i somehow can't button both, changes pic won't call php. code: <?php $db = new pdo('mysql:host=localhost;dbname=mysettings;charset=utf8mb4', 'testuser', '1234567890'); $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); $db->setattribute(pdo::attr_emulate_prepares, false); try { $mytable = $_session["sess_myuserid"]; if($mytable == null) {$url='login.php'; echo '<meta http-equiv=refresh content="1; '.$url.'">';} $stmt = $db->prepare("select * ".$mytable); $stmt->execute(); $result = $stmt->fetchall(pdo::fetch_assoc); $conn = null; echo'<script>'; $count = count($result); ($i = 0; $i < $count; $i++) { $theid = $result[$i]['id']; $thefunction = $result[$i]['thefunction

java - App crashing during onTextChanged() -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i making simple notes app sqlite. has 2 activities , helper class sqlite. when click on example note(akhilesh chobey) in mainactivity.java , , try edit in main2activity.java application crashes. main activity: public class mainactivity extends appcompatactivity { listview noteslistview; static arraylist<string> notesarraylist; arrayadapter<string> adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); noteslistview = (listview) findviewbyid(r.id.noteslistview); notesarraylist = new arraylist<string>(); notesarraylist.add("akhilesh chobey"); adapter = new arrayadapter<string>(this,

JSF CDI Conversation scope -

i have problem cdi scope. i have bean conversation scoped, clientcontroller, have client , phone object push in service order. when register new client, can push 1 or more phones client. this, have used conversation scope. each request push new phone client executing @postcontruct method, doing bean lose state, giving begin on conversation when push first phone. at first, guess problem bean configuration, when removed template declared on client page, application works correct. template use bean session scope, control page language user choice. next has code, , can follow code on github repository link https://github.com/mcqueide/service-order . clientcontroller.java package br.com.codeshare.controller; import java.io.serializable; import java.util.arraylist; import java.util.list; import java.util.map; import javax.annotation.postconstruct; import javax.enterprise.context.conversation; import javax.enterprise.context.conversationscoped; import javax.enterprise.inject.p

java - Good way of calling Functions/class in big if/else constructs -

i've seen many code-parts in old(java mostly) projects if(type == typeone){ callfunctionone(); }else if (type == typetwo){ callfunctiontwo(); }else if (type == typethree){ callfunctionthree(); }//i've seen on ~800 lines this! where "type" enum or , whole thing written in switch/case style too. question is: there "better"(more stylish/shorter/more readable) way achieve this? i've seen constructs in php like: //where $type = "one","two" etc. $functionname = 'callfunction' . $type; new $functionname(); but im not sure if realy "better" way , if possible in other languages. the more interesting question imo want achieve this? java object-oriented language. therefore solve 1 subclass per type: abstract class type{ abstract void method(); } class type1 extends type{ void method(){ //do sth. specific type } } if methods in same class still call them out of these

d3.js - Stacked bars not showing up with unique sets of data -

i trying show different countries , citywise population using stacked bar chart data set being unique cities , countries being uniquely exclusive each other chart showing first data in set per code. how make work show data in different stacked bars each country. here code have tried far : https://jsbin.com/qopazukahi/edit?html,output . below dataset: var data=[ { "country": "india", "delhi": 310504, "kolkata": 552339, "chennai": 259034, }, { "country": "australia", "melbourne": 62083, "sydney": 85640, "perth": 42153, "canberra": 74257, }, { "country": "usa", "new york": 415910, "miami": 828669, "frankfort": 362642, "portland": 601943, "topeka": 1804762, }, ]; here complete code: <!doctype html> <meta charset=&qu

css - How to make right/left icons/text lists in Bootstrap? -

Image
i'm converting old site responsive site using bootstrap, want find general solution converts old layout format uses tables show icons on left , text on right. so need show texts regardless of length next icons in list this: but if width gets small, should show this: the icon can either graphic, font awesome character, or word, , should stay same width. but right text width should able vary in length , wrap stay left aligned right of icon. so far, have this: <div class="row"> <div class="col-xs-1">icon</div> <div class="col-xs-11">this longer text.</div> <div class="clearfix"></div> <div class="col-xs-1">icon</div> <div class="col-xs-11">this longer text.</div> <div class="clearfix"></div> </div> but on width "lg" breaks up: and on width "xs" wraps under: how can make th

ruby on rails - How to handle validations between associated objects? -

i having difficulty in validating 2 objects across complex associations. here's example of have: car.rb class car has_many :passengers end passenger.rb class passenger belongs_to :car belongs_to :info end validations need do: the number of passengers limited passengers have association object called info has "employer" string. passengers must have same employer. the interface has multiselect box choose passengers. once you're done selecting passengers, click "create" (or "update", has it's own set of problems). when controller tries create car , needs run car validations, passenger validations need pass (employer check), , car needs ensure it's not exceeding passenger count. if 1 of these fails, need reset , take them new page. during update, if fails, need restore original passengers car. i'm not sure how perform validations without saving objects database though. in addition, once objects saved database

vb.net - Compare value with a DataType to see if it accepted -

issue i have method used check values see if accepted datatype in database column. i have list of values added database , list of datatype's table added to, , want make sure when run stored procedure add values values correct. code private function checkalldatatypes(formatteddate string, sstring string(), file fileinfo) boolean using dbconn rgsdb2.dbconnection = dataconnections.dbconnection() tabledatatypes = dataconnections.executequery_singleresultsetwithparams("selltabledatatypes", dbconn, params) end using each item string in sstring //i want compare values in sstring tabledatatypes. next end function example so lets see table columns wanting add int,varchar,varchar , values in sstring 3,"testing",3 . this should fail 3 not string. use regex in testing loop check numbers strings if don't want consider them string. integers can strings need check being "alone" were. might 3

css - SASS - When Class is Activated - Change Another -

in sass file have styling slick carousel , loading spinner. when class slick-initialized appears possible set display:none on spinner. for example - from: slick.slick-initialized { display: block; } to like: slick.slick-initialized { display: block; &.spinner { display none }; } where have: <div class="row"> <div class="spinner"></div> <slick init-onload=true data="qnew" dots=true arrows=false> <div class=“tile" ng-repeat="question in questionsnew"> <span ng-bind-html="question.question"></span> </div> </slick> </div> if .spinner element placed after .slick element you can write scss scss slick.slick-initialized { display: block; + .spinner { display none }; } html <div class="row"> <slick init-onload=true data

smt - Transpiling language constructs to z3 -

i looking discussion of how convert various programming language constructs z3, without limiting efficiency of solver. in particular, there algorithm , set of best-practice rules converting function/program expressed in continuation passing style z3? the use context use z3 implementing type system programming language, solution has efficient , incremental (e.g. retain previous z3 asts in z3 instance). i aware of boogie, looking more lightweight if possible. constraining semantics of input language acceptable, not far trivially expressible in smtlib. i looking discussion of different strategies 1 might consider various typical language constructs. edit: might acceptable have restrictions make input language non-turing-complete , reasonable efficient smaller program fragments (like functions in library). e.g. input language language writing "statically checked" libraries later transpiled down libraries existing dynamic programming language dynamic runtime assert

ruby on rails - How to make data saved in database expire after a time period? -

i'm building store in rails. store has orders, order_items, users.. right when customer adds order_item cart, order unique id created automatically, , order_items saved under order_items model. there validation saying 3 order_items allowed in 1 order. if possible, remove order_items saved model after 30 days. 30 days counter should start after saving 3 order_items. how can achieve this? thanks class order < activerecord::base belongs_to :order_status belongs_to :user has_many :order_items validates_length_of :order_items, maximum: 3 #only 3 order_items allowed within order each user before_create :set_order_status before_save :update_subtotal def subtotal order_items.collect { |oi| oi.valid? ? (oi.quantity * oi.unit_price) : 0 }.sum end private def set_order_status self.order_status_id = 1 end def update_subtotal self[:subtotal] = subtotal end end order_item.rb class orderitem < activerecord::base belongs_to :prod

php - How to change the domain of url that the browser is showing in download page -

i have script used download files website, on downloading page of browser, shows url of sender. if file downloading http://localhost/w/download.zip shows same url, want give fake domain or url, http://www.example.com/download.zip . means want change url or domain browser reporting download from. know can done <a href="download.php?d=<?php echo $_get['d']; ?>" target="_blank">download!</a> but not change domain. , shows me link domain. question : how do that? if want show different url user when hovers mouse over, use javascript it, google similar. here's simple example: <a href="https://www.google.com/" onclick="location.href='https://www.facebook.com/';return false;">google?</a> the browser show google.com when hovering on link, when clicked, javascript redirects facebook.com , cancels default behaviour. note won't work if javascript disabled in user's brow

Excel 2013 VBA - setting up a list of email reciepients (TO and CC) populating Oulook email -

Image
i have set userform saves data incident details data sheet , saves data temporarily worksheet called 'email form' , laid out form 'email form' copied body of ms outlook email. this works perfectly, , current coding provided sends 1 email to 1 recipient , cc'd another, need send same email multiple recipients. have created sheet called ‘email recipient list (same workbook) because want easy update lists required (none of users able edit hardcode in vba). column has list of recipients , column b has list of cc recipients. i have searched , view several videos , sites, have been unable workout how extract respective lists ‘email recipient list’ sheet , populate outlook email without affecting existing actions. don't want macro button users click because code opens outlook email. this existing code: sub log_send_reset() 'this opens outlook details of form 'works "email form" dim secincno string 'this bit emails current workshee

Radio button inside select 2 options angularjs -

is there way have radio button attached options in select in angularjs ? this radio button each item in dropdown list. i used ng-html-bind add radio button not working out. i using normal select , tried deprecated ui-select2 .nothing works new angular-ui ,ui-select works