Posts

Showing posts from April, 2011

netlogo - How to stop two breeds of turtles from repeating the same command? -

this first time posting, criticism appreciated! started netlogo recently, , have move way model working on. model suppose evaluate farmers join a) ecommerce or b) traditional means. both, ecommerce , traditional commerce increase farmers' wellbeing differently. ideally, these 2 breeds of turtles join ecommerce or traditional commerce. turtles joined ecommerce evaluate if wellbeing better off once joined ecommerce. if not, traditional commerce turtle , join it. turtles went traditional commerce should decide join ecommerce if there other turtles using ecommerce in proximity. still don't have part of code since stuck on one. unfortunately, part of code: set wellbeing wellbeing + traditional-wellbeing-value makes turtles' wellbeing increase every tick on time. looking way prevent turtles increasing wellbeing on , on again. then, have each turtle evaluate current wellbeing , decide move if needed. below code i've come far: globals [ area max-farmers max-patche...

netduino - vistual studio 2017 from mac not install .net mf sdk 4.3 -

netduino mac vistual studio 2017 mac, plugin version 0.6.1 build output: netmf_test/netmf_test/netmf_test.csproj(3,3): error msb4019: imported project "/library/frameworks/mono.framework/versions/5.2.0/lib/mono/xbuild/microsoft/.net micro framework/v4.3/csharp.targets" not found. confirm path in declaration correct, , file exists on disk. (msb4019) (netmf_test) thank's!

javascript - Getting Attribute from Table Cell into Script -

i'm generating html table contains rows one: i've been able id , trackingnumber value, i'm trying data-categoryname-id value , i'm stumped. here's script: $("input[type='text']").change(function() { var parent = $(this).parents('tr'); var recid = $(this).closest('td').attr('id'); var trackingnumber = $(this).val(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <tr id="53462365"> <td>jb44566</td> <td>sku123</td> <td>carton paper a4</td> <td>paper</td> <td></td> <td>966257111</td> <td></td> <td id="53462365"><input type="text" class="form-control" placeholder="tracking #" name="trackingnumber" data-categoryname-id="office supplies" autocom...

How to raise frequency of sounds - javascript -

i trying raise frequency of every node in sound. have tried many ways. here small code work, it's not working. please help. in advance. <script src="./wad.js"></script> <script src="./tuna.js"></script> <script> var countaudio = 1; var voice = new wad({source : 'mic'}); var tuner = new wad.poly(); tuner.add(voice); voice.play({volume : 1}); logpitch(); function logpitch() { tuner.updatepitch() localstorage.setitem(countaudio, tuner.pitch) countaudio = countaudio + 1; if (countaudio < 1000) { settimeout(logpitch, 5) } else { tuner.stopupdatingpitch() voice.stop() highvoice(countaudio) } }; = 1; var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); function playnote(frequency, duration) { var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.value = frequency; // value in hertz oscillator.connect(audioctx.destinati...

java - Android Rename File using Google Drive REST API v3? -

how rename file using google drive rest api on android? have searched internet could, can't find how this. i trying write sync method moves , renames cloud files if detects local copy has been moved or renamed: void syncmetadataonly (com.google.api.services.drive.model.file cloud, java.io.file local) throws ioexception { workspace.finf fileinfo = workspace.getfileinfo (this, local); // metadata object. map<string, string> appproperties = cloud.getappproperties (); // keep track of last rename , move in our private app properties: long cloudlastrename = appproperties.containskey ("last-rename") ? long.valueof (appproperties.get ("last-rename")) : 0; long cloudlastmove = appproperties.containskey ("last-move") ? long.valueof (appproperties.get ("last-move")) : 0; boolean needupdate = false; boolean needn...

use of fft, ifft and fftshift in matlab -

i trying implement split-step fourier method solve nonlinear schrodinger equation in optics. treats linear part , nonlinear part separately. solves linear part using fourier transform , nonlinear part in time domain. the following code copied book: alpha = 0 beta_2 = 1 gamma = 1 t = linspace(-5,5,2^13); delta_t = t(2)-t(1); l = max(size(a)); delta_omega = 1/l/delta_t*2*pi; omega = (-l/2:1:l/2-1)*delta_omega; = 2*sech(t); a_t = a; step_num = 1000; h = 0.5*pi/step_num; results = zeros(l,step_num); a_f = fftshift(fft(a_t)); n=1:step_num a_f = a_f.*exp(-alpha*(h/2)-1i*beta_2/2*omega.^2*(h/2)); a_t = ifft(a_f); a_t = a_t.*exp(1i*gamma*(abs(a_t).^2*h)); a_f = fft(a_t); a_f = a_f.*exp(-alpha*(h/2)-1i*beta_2/2*omega.^2*(h/2)); a_t = ifft(a_f); results(:,n) = abs(a_t); end where a_t pulse (the function solved). don't understand in beginning uses fftshift shift 0 frequency center, later in loop doesn't have fftshift . tried adding fftshift ma...

java - Sqoop 1.99.7 Installation on Centos 7 -

i new hadoop eco system. i in process of setting hadoop eco system on single node. hadoop system been setup , working fine along hbase , hive. to connect external sources of data, setting sqoop 1.99.7 server. finding difficult setup, documentation creating sort of confusion. can 1 me step step process... steps done me far .. java 1.7 version - available hadoop common - been setup , verified downloaded , installed sqoop version 1.99.7 configured ~/.bashrc file export sqoop_home=/usr/lib/sqoop export path=$path:$sqoop_home/bin source bashrc file now not clear, per documentation provided, on , stuck here last 1 day... 1. creating third party jars - have created directory /var/lib/sqoop2 using mkdir -p /var/lib/sqoop2 (creation did not give error , unable locate directory) hence copy mysql-jdbc* files, postgresql-jdbc not done. unable locate mysl-jdbc* files in server path 2. presume no action required configure sqoop_boot starp. properties , sqoop.properties ...

Chrome Extension: How do I change the color of an HTML canvas using pure javascript? -

this question has answer here: the chrome extension popup not working, click events not handled 2 answers chrome extension content security policy directive error 3 answers i'm working on building first google chrome extension have run problem. i want extension make popup window when icon clicked. window display canvas thats color change, green, when button clicked. i've tested code on websites such codepen , works fine not when run in chrome. all of extension's files in same folder. here html: <!doctype html> <html> <head> <script src="popup.js"> </script> </head> <canvas id="canvs" style="border: 2px solid black"></canvas> <input type = "button" value = "c...

c# - Unity3d Drawing curves to show the angle between vectors -

Image
i'm trying show interactively angle between 2 vectors in unity3d. example, i need draw curve between "vectors" , show numeric value in degrees. know how calculate angle, got no success on how "draw" curve between them. tried use bezier curves, no success either. i answer totally different. you can try , go beziers or catmull-rom make more complex when can achieve more easily. place circle ui image @ origin of angle. set type filled , clockwise. now have slider indicating amount, match angle image image = getcomponent<image>(); image.fillamount = getangle() / 360f; // range 0/1 need normalization https://docs.unity3d.com/462/documentation/manual/script-image.html

smartsheet api - Multi-row email does not work -

would able provide example code of multi row email works on machine? can't version of example code in documentation send multiple rows links relevant rows. i able grab cell values, links rows well. and, can't seem html format manually using api email capabilities.

Reading binaryFile with Spark Streaming -

does 1 know how setup ` streamingcontext.filestream [keyclass, valueclass, inputformatclass] (datadirectory) to consume binary files. where can find inputformatclass ? documentation give no links that. imagine valueclass related inputformatclass somehow. in non-streaming version using method binaryfiles, can bytearrays each files. there way can same sparkstreaming ? if not can find details. meaning inputformat supportted , value class produces. can 1 pick keyclass, aren't element connected ? if clarify use of method. edit1 i have tried following: val bfiles = ssc.filestreambyteswritable, byteswritable, sequencefileasbinaryinputformat however compiler complain such: [error] /xxxxxxxxx/src/main/scala/estimatorstreamingapp.scala:14: type arguments [org.apache.hadoop.io.byteswritable,org.apache.hadoop.io.byteswritable,org.apache.hadoop.mapred.sequencefileasbinaryinputformat] conform bounds of none of overloaded alternatives of [error] value filestream:...

xml - Jaxb and unmarshalling included XSD -

i have 2 xsds 1 xsd contains element can contain elements second one. basically, xsd 1 has element "etta" can contain element xsd 2. i used xjc generate classes, , when deserialized, meta element contains elements xsd 2 jaxbelements instead of actual classes generated xsd 2. included both sets of classes program, , package-info correct. this how defined xsd. imagine problem "any" element. <xs:schema xmlns="ns1" elementformdefault="qualified" xmlns:ns1="ns2" targetnamespace="ns1" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:import namespace="ns2" schemalocation="./ns2.xsd" /> <xs:complextype name="meta"> <xs:sequence> <xs:any namespace="ns2" minoccurs="1" maxoccurs="unbounded"/> </xs:sequence> </xs:complextype> ... </xs:schema> so ...

css - What can you put into a media query expression? -

in following media query styles defined in style declaration applied when viewing via screen , when minimum width 480px wide (correct?): @media screen , (min-width: 480px) { #leftsidebar {width: 200px; float: left;} #main {margin-left:216px;} } what else can put expression statement? for example, condition on url fragment: @media screen , (document.location.hash=="#about") { #leftsidebar {width: 200px; float: left;} #main {margin-left:216px;} } @media screen , (document.location.hash=="#services") { #leftsidebar {width: 200px; float: left;} #main {margin-left:216px;} } @media screen , (document.location.hash=="#contact") { #leftsidebar {width: 200px; float: left;} #main {margin-left:216px;} } what can put media query expression? you can put media feature. available media features documented in spec ( mq3 , mq4 ). for example, condition on url fragment: that's unfortunately not possibl...

api - Android Studio GeoDataClient cannot be resolved -

i haven't seen problem anywhere on internet, doesn't seem library deprecated, can't add import: import com.google.android.gms.location.places.geodataclient; my android sdk date. does know how use it? or rather, way current location on gps? thanks lot. try add ```gradle compile 'com.google.android.gms:play-services-maps:11.2.0' compile 'com.google.android.gms:play-services-places:11.2.0' compile 'com.google.android.gms:play-services:11.2.0' compile 'com.google.android.gms:play-services-location:11.2.0' ``` in build.gradle , may need add ```gradle allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } } ``` finally, build -> rebuild project , there simple demo using google map api & google direction api , , on, in my github . hope you.

process - How does credit based scheduling algorithm work? -

i've been trying implement on java simulation of credit based schedular algorithm not understand logic of algorithm. i've read description of algorithm on website can't understand how use credits=credits/2+priority given fact credits supposed 0. please give detailed description of algorithm because have academic project deliver based on it.

Visual Studio 2015 / 2017 times out on connecting to Microsoft R Open (3.4.0.0) or CRAN -

unable connect microsoft r open or cran r selecting either through workspaces window in vs2015 , 2017 community editions on windows 10. "connecting ...." dialog appears , following error appears in interactive window. connecting r workspace failed. reason: timed out while waiting broker process report endpoint uri interactive window disconnected r session. open workspaces window , either select local r interpreter or try connecting remote machine. have uninstalled/reinstalled r , rtvs. have tested both r installations via rgui , r studio. any direction appreciated! you need vs 2017 update 3 use r 3.4. officially released last week, may not have yet. try updating vs.

javascript - Angular - Calling another components function to toggle a div's display -

i have 2 components, 1 header , 1 plain text @ moment. on header there menu pick options. when 1 of options clicked on header, want toggle boolean in other component , display entire html. how can onclick() in header menu? console says function i'm trying call undefined. //this in 1 folder... export class educationcomponent { showeducation: boolean = true; toggleeducation () { this.showeducation = !this.showeducation; } }   //this is different folder... <li><a (click)="toggleeducation()">education</a></li> the purpose of component class provide properties , methods needed component's template. template associated class find properties , methods. if need share properties or methods across several components, use angular service instead. i have blog post angular services here: https://blogs.msmvps.com/deborahk/build-a-simple-angular-service-to-share-data/ the code looks this: import { injectable } ...

oracle - What does the (2) mean in the below SQL query -

someone please explain why 2 used in below query. select * employee e where(2) = (select count(distinct(e1.sal)) employee e1 e.sal > e1.sal); the query returns employees salary higher 2 other salaries. parentheses misleading , isn't needed. select * employee e 2 = (select count(distinct(e1.sal)) employee e1 e.sal > e1.sal); for example, given follow employees data: employee salary joe $80,000 kate $80,000 lee $85,000 chris $85,000 matt $85,000 mike $90,000 june $90,000 jack $100,000 query returns mike $90,000 june $90,000 because 90,000 greater 80,000 , 85,000 notice jack not returned because salary greater 3 other salaries. note there 5 employees salary less mike's , june's distinct keyword forces count 2.

sql - MySql on duplicate key set last_insert_id is causing auto_increment to jump -

Image
i have query goes follows: insert table(columns) values(values) on duplicate key update id=last_insert_id(id) i use id of inserted or existing row of data. $id=$connection->lastinsertid(); well have issue auto_increment jumping each duplicate key update. i on duplicate key update part causing these jumps. source of problem? there way fix within query without reseting auto_increment entirely every time?

bazel pypi macro self-edge -

i'm stumbling around trying bazel working pypi dependencies. ./pypi.bzl: def _impl(ctx): ctx.actions.run_shell( command = "pip download %s" % ctx.package ) _pypi_package = rule( implementation=_impl, attrs={"package": attr.label(mandatory=true)}, ) def pypi_package(package): _pypi_package(name = package, package = package) ./build: py_binary( name = "app", srcs = ["app.py"], deps = [":python-dateutil"] ) load("//:pypi.bzl", "pypi_package") pypi_package( package="python-dateutil", ) trying build: $ bazel build app error: /path/to/cwd/build:9:1: in _pypi_package rule //:python-dateutil: cycle in dependency graph: //:app .-> //:python-dateutil [self-edge] `-- cycle occurred because of configuration option. error: analysis of target '//:app' failed; build aborted. info: elapsed time: 0.219s no idea if right approach working external dependencies, ig...

sql - How to get Top 1 with Sort from Join -

instead of doing this: select t1.*, (select top 1 t2.name table2 t2 order t2.number) val1 table1 t1 how done join instead? select t1.*, top 1 t2.name table1 t1 join table2 t2 order t2.number or possible? select top 1 * (select t1.*, t2.number num table1 t1 join table2 t2 on t1.commoncolumn=t2.commoncolumn ) t order t.num

swift3 - Pass variable to next View Controller -

i want pass variable 1 view controller another. first view controller looks , segue gets triggered correctly , new view controller gets displayed. @ibaction func testbutton(_ sender: any) { let timervc = timerviewcontroller() timervc.secondspassed = textfield_seconds.text! navigationcontroller?.pushviewcontroller(timervc, animated: true) } on next view controller (timerviewcontroller) declared variable in class header var secondspassed:string! and in viewdidload want print value console , receive 'nil'. i looked through various tutorials seem not find correct answer work. anyone around clue? thanks in advance... if using segue, can remove line presents controller (you don't seem have navigationcontroller anyway): navigationcontroller?.pushviewcontroller(timervc, animated: true) now correct way pass data vc using segues this: override func prepare(for segue: uistoryboardsegue, sender: any?) { if let vc = segue.destination...

sql - I need to compare 2 tables in MySql and dispaly the differences -

both tables table_a , table_b has compared using employee_id column present in both of them. both tables have millions of rows. 3 results must displayed- employee_id present in table_a not present in table_b. vice-versa. there case when particular employee_id present in both tables data in other columns employee_id might not same in both tables. these rows must displayed showing columns there data mismatch. since there millions of rows in both tables, process must fast both tables can compared quickly. using mysql server write query. this rather tricky, here example assuming employee_id unique in each table: select employee_id, (case when max(which) = 'a' 'a-only' when min(which) = 'b' 'b-only' else 'both' end) which, concat_ws(',', (case when count(*) = 2 , not min(col1) <=> max(col1) 'col1' end), (case when count(*) ...

python - Tensorflow onehot encode -

i'm new @ using tensorflow , have questions tensorflows 1 hot encoding. i want read cvs file in in last column represents labels. labels integer values 1 7. i want classification using softmax model. therefore need labels in onehot tensor format? is there simple way/tensorflow built-in convert labels 1 hot? according tutorial file parsing have following code parsing csv part of 1 hot encoding missing. def read_from_cvs(filename_queue): reader = tf.textlinereader() key, value = reader.read(filename_queue) record_defaults = [[] col in range((num_attributes))] # no defaults, values must given attributes = tf.decode_csv(value, record_defaults=record_defaults) features = tf.stack(attributes[1:-1]) labels = tf.stack(attributes[-1]) return features, labels def input_pipeline(filename = 'dataset.csv', batch_size = 30, num_epochs=none): filename_queue = tf.train.string_input_producer(filename, num_epochs=num_epochs, shuffle=true) ...

Python strings and if statements -

Image
i having trouble python code. question supposed write program below code. code works fine in wing ide when run different input values steps, when submit system checks code errors shown below. in advance help. code below. def activity_level_from_steps(steps): """takes amount of steps , returns level of exercise equals""" steps = int(steps) if steps < 1: level = 'alive?' elif steps >= 1 , steps < 5000: level = 'sedentary' elif steps >= 5000 , steps < 7500: level = 'very low' elif steps >= 7500 , steps < 10000: level = 'low' elif steps >= 10000 , steps < 12500: level = 'active' else: level = 'very active' return level the question required solve the error system checks code gives me first, you'll need indent function body properly, since indentation important (tm) in python. ...

python - Plotly icreate_animations offline on Jupyter Notebook -

i trying replicate this plotly tutorial on jupyter notebook dataset matches 1 given in example, had change name of 1 column. issue here being offline command py.icreate_animations(figure) which in offline notebook mode becomes icreate_animations(figure) is not recognized. furthermore, if try iplot(figure) command, use static plots, long error raised: --------------------------------------------------------------------------- attributeerror traceback (most recent call last) <ipython-input-27-b81a66612f63> in <module>() 38 figure['layout']['sliders'] = [sliders_dict] 39 ---> 40 iplot(figure) //anaconda/lib/python2.7/site-packages/plotly/offline/offline.pyc in iplot(figure_or_data, show_link, link_text, validate, image, filename, image_width, image_height, config) 330 config.setdefault('linktext', link_text) 331 --> 332 figure = tools.return_figure_from_figure_or_data(figu...

java ee - How does Gradle resolve the javaee-api dependency to build an EAR? -

i see there's ear plugin gradle. how used build ear ? yes, there's ear task. build ear ejb module there's dependency on java-ee. how dependency resolved? https://virgo47.wordpress.com/2015/05/13/why-gradle-doesnt-provide-provided/ http://www.lordofthejars.com/2015/10/gradle-and-java-ee.html http://www.adam-bien.com/roller/abien/entry/the_only_one_dependency_you i don't mind reading fine manual -- please specify chapter @ least rather rtfm because fine manual states: 51.4. dependency management the ear plugin adds 2 dependency configurations: deploy , earlib. dependencies in deploy configuration placed in root of ear archive, , not transitive. dependencies in earlib configuration placed in 'lib' directory in ear archive , transitive. to reading doesn't explain in concrete fashion how java-ee dependency resolved. project (rough): gradleear/ ├── build.gradle ├── gradle │   └── wrapper │   ├── gradle-wrapper...

yui3 - How to localize the alloyui scheduler component? -

i trying localize alloyui scheduler in french. following article: how can localized version of yui 3 or alloyui component? job done. still missing tips 2 things: - need time format in left column changed 1-12am/pm 1-24 - don't succeed localize "all day" term in left top corner (or @ least way hide it). any welcome

How to disable right click on youtube embed IFRAME? -

i placing youtube video on website. want disable right click no 1 can have access video directly. below code snippet: <iframe width="100%" height="563" src="' . $yturl . '?controls=' . $controls . '&rel=0&showinfo=0&autoplay=' . $autoplay . '" frameborder="0" allowfullscreen></iframe>` is there way achieve this?`

sublimetext3 - Unable to fold divs in Sublime Text 3 -

Image
only of arrow icons in gutter rended; aren't and, therefore, can't clicked. have emmet installed , shortcuts don't work on divs either. only ones adjacent arrows can folded. any tips? as see can fold divs begin thick gray line. in bottom right corner should see spaces: x(x number, guess have 4), click on , change 2 spaces. should solve problem. edit: guess practice change indentation spaces.

reactjs - ReactDOM.render webpack error -

there annoying error have no idea how it's error, i rendering muithemeprovider in react dom this reactdom.render( <muithemeprovider muitheme={getmuitheme()}> <router history={browserhistory} routes={routes} /> </muithemeprovider>, document.getelementbyid('react-app')); but webpack giving me error: error in ./client/src/app.jsx module build failed: syntaxerror: unexpected token (14:2) 12 | 13 | reactdom.render( > 14 | <muithemeprovider muitheme={getmuitheme()}> | ^ 15 | <router history={browserhistory} routes={routes} /> 16 | </muithemeprovider>, 17 | document.getelementbyid('react-app')); i tried div instead, didn't work. tried adding const call in render, didn't work. i don't understand. here file code: import react 'react'; import reactdom 'react-dom'; import injecttapeventplugin 'react-tap-event-plugin'; import getmuitheme 'materi...

Single URL for all Sub URL in PHP & HTML -

i need if user @ www.xyz.com/z or www.xyz.com/z.trial.php or www.xyz.com/offer.php url bar should show , www.xyz.com . yes, it's easy have iframe , iframe not work url copied , pasted manually in url bar. i thankful if provides me hint code. it possible.. suppose directory structure - wamp/www/project/.htaccess wamp/www/project/myproject wamp/www/project/myproject/file1.php wamp/www/project/myproject/file2.php wamp/www/project/myproject/file3.php your .htaccess file code # turn rewrite engine on rewriteengine on # map neat url internal url rewriterule ^myproject/sub1$ myproject/file1.php [nc,qsa] rewriterule ^myproject/sub2$ myproject/file2.php [nc,qsa] rewriterule ^myproject/sub3$ myproject/file3.php [nc,qsa] sub1, sub2, sub3 can changed because hiding actual resource (php file / html file) user this concept used in designing rest webservice using core php. you can use simple php project. hide actual resource location end user's hop...

How can I apply same animation for list of html elements one by one with angular 4 animation? -

i'm trying apply angular 4 animation list of html elements facilities = ['<p> <span class="glyphicon glyphicon-hand-right"> </span> text 1</p>', '<p> <span class="glyphicon glyphicon-hand-right"></span>text 2</p>', '<p> <span class="glyphicon glyphicon-hand-right"></span> text 3</p>', '<p> <span class="glyphicon glyphicon-hand-right"></span> text 4</p>', ]; one 1 below code: animations: [ trigger('flyinout', [ state('in', style({transform: 'translatex(0)'})), transition('void => *', [ style({transform: 'translatex(-100%)'}), animate(100) ]), transition('* => void', [ animate(100, style({transform: 'translatex(100%)'})) ]) ]) ] when put trigger list elements, elements come 1 scree...

Deploying a favicon on Heroku using Node.js and express seems to crash the app -

i have standard line in index.js (using serve-favicon module): app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); and have favicon.ico in /public directory. favicon deploys fine locally, when push heroku, entire app can't served. feedback i'm getting heroku @ logs, show successful build/deploy. any idea what's here? edit: here's requested package.json: { "name": "requesttest", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "body-parser": "~1.17.1", "cookie-parser": "~1.4.3", "debug": "~2.6.3", "events": "^1.1.1", "express": "~4.15.2", "morgan": "~1.8.1", "pug": "~2.0.0-beta11", "request": ...

mysql - how to insert dynamically added form fields in database using php -

i want add dynamic form fields in database using php. have used angular add dynamic form fields. thing when trying insert data database last form field inserting in database. so, used array , loop increment , update form field database. somehow query not working , data not inserting database. can tell me wrong here? stuck. please help. thanx in advance php code: <?php if(isset($_post['submit_row'])) { $link = mysqli_connect("localhost", "root", "", "midata"); // check connection if($link === false){ die("error: not connect. " . mysqli_connect_error()); } $camp_name = mysqli_real_escape_string($link, $_request['camp_name']); $start_date = mysqli_real_escape_string($link, $_request['start_date']); $end_date = mysqli_real_escape_string($link, $_request['end_date']); $store = mysqli_real_escape_string($link, $_request['$store']); $elements= $mysqli->real_escape_string($_post[...

delphi - TryGetvalue doesn't work if individual items are freed - memory leaks if they aren't -

i discovered win32 compile of fmx application has bug! the problem trygetvalue returns unknown mypoi's if {$define free_mypoi} . if don't define (ie. not free each instance of mypoi after added dictionary), eurekalog reports memory leaks when app exits (my poi hasn't been freed obviously). most interesting, problem doesn't occur in android version of code free_mypoi defined. (thankfully) is way of adding items dictionary correct? (for android , win32 fmx) here core code: type tmypoi = class(tobject) public value: integer; timestamp: tdatetime; end; ... function tform2.createorupdate(username: string; newtimestamp: tdatetime): string; var poitimestamp: tdatetime; mypoi: tmypoi; index: integer; begin if poidict.trygetvalue(username, mypoi) begin // existing poi result := inttostr(mypoi.value) + ' ' + datetimetostr(mypoi.timestamp); poitimestamp := mypoi.timestamp; // update poi's timestamp mypoi.ti...

Spring Boot with Angular 2 - place for assets(images) -

Image
i have problem mapping resources. have multi-module project first module if angular 2 server spring boot in second module. configured problem connected path resources. on left compiled spring module added build angular 2 app. in angular module have other localization assets but when angular build project, flatten whole project , compiled strucutre following

Error with Joomla 3.x.x Shortcode plugin and module -

i want write joomla add-in articles can add count down timer. able run using, example, shortcode [countdowntimer date = "23-9-2017" time = "13:42"] . not know how can add parameters shortcode , move them module. replacing [countdowntimer] on counter i've done. <?php defined( '_jexec' ) or die(); class plgcontentshortcode extends jplugin { protected $autoloadlanguage = true; function oncontentprepare ($context, $article, $params, $limitstart) { // preg_match("/([[]countdowntimer(.*)[]])/", $article->text, $tmp, preg_offset_capture); // i'm trying extract parameters in way // preg_match("/date=\"([0-9-]+)\"/", $tmp[2][0], $return_tmp['date'], preg_offset_capture); //date // preg_match("/time=\"([0-9:]+)\"/", $tmp[2][0], $return_tmp['time'], preg_offset_capture); // time $article->text = preg_replace('/([[]countdowntimer(.*)[]])/...

Query and compare date on google sheets -

i'm working on making replica of sheet1 on sheet2 (same document), , query() worked fine until column want filter formula cells (long ones each query, match, etc). what want filter rows in sheet1 event date in column m upcoming (there more filter conditions simplify main problem). i don't want rows date either empty, in past (various date formats), or formula give result of empty string "". the formulas i've tried (which gives error) - note i'm selecting 2 columns testing: =query(sheet1!a3:n, " select i,m = 'singapore' , datevalue(m)>today() ",0) =query(sheet1!a3:n, " select i,m = 'singapore' , m>today() ",0) this formula doesn't give error doesnt show correct data - shows data except jan 2017 - august 7 2017: =filter(sheet1!a3:n, sheet1!i3:i="singapore", sheet1!m3:m>today()) this formula gives empty output: =query(sheet1!a3:n, " select i,m = 'singapore' , m='22 a...

python pexpect failing for curl output -

i capturing curl output after spawning remote machine. expect function keeps getting timed out , tried different patterns still no luck. curl request of form , hdl2.sendline("curl -v http://{0}/index.html -o /dev/null".format(host1)) the output received " > /index.html http/1.1 > user-agent: curl/7.35.0 > host: 13.126.208.1 > accept: */* < http/1.1 200 ok < date: sun, 20 aug 2017 12:32:54 gmt * server apache/2.4.7 (ubuntu) not blacklisted < server: apache/2.4.7 (ubuntu) < last-modified: sun, 20 aug 2017 09:56:44 gmt < etag: "2cf6-5572c61363668" < accept-ranges: bytes < content-length: 11510 < vary: accept-encoding < content-type: text/html < { [data not shown] 100 11510 100 11510 0 0 3055k 0 --:--:-- --:--:-- --:--:-- 3746k * connection #0 host 13.126.208.1 left intact ubuntu@ip-172-31-28-48:~$ " this end output , have given expect as hdl2.expect("\$ ") but every time pexpe...

android - Is there any python package for parsing pkcs7? -

Image
i'm extracting features android .apk files androguard , right need extract serial number(*) signature file (usually cert.rsa). i've found asn1crypto , don't quite understand, how use pkcs7. there python package suitable purpose? (*): comment : have pkcs7 memory object, not file pyopenssl not read file ! openssl.crypto.load_pkcs7_data(type, buffer) load pkcs7 data string buffer encoded type type. type type must either filetype_pem or filetype_asn1). from openssl import crypto pkcs7 = crypto.load_pkcs7_data(crypto.filetype_asn1, open('certs/signature.der', 'rb').read()) certs = get_certificates(pkcs7) cert in certs: print('subject:{}, serial nnumber:{}'. format(cert.get_subject(), cert.get_serial_number())) >>>subject:<x509name object '/cn=key1'>, serial nnumber:13315126025841024674 >>>subject:<x509name object '/cn=key2'...