Posts

Showing posts from June, 2010

can anyone tell how to use stored procedure in mysql database to insert and update same table? -

can tell how use stored procedure in mysql database insert , update same table? create procedure inst_upd_pro(in product varchar(50),price int(30),stock int(30),active int (30)) begin declare id int; select id_pro id products; if(id_pro=id)then update products set product=product, price=price, stock=stock, active=active id_pro=id; else insert products (product, price, stock, active) values (product, price, stock, active); end if; for clarity , avoid confusion (for , mysql) name incoming parameters prefix of in_ , declared variables dec. select incorrect - should looking specific product (that in in parameter) , if condition incorrect should comparing declared variable in parameter.

angularjs - Azure Media Player not playing video in Angular JS on revisit the view -

i have consumed azure media player in angularjs application , able view video. on revisit same view video tag present, not playing video, audio playing in background. i using ui-router routing. thanks in advance quick help. here angular js code view video var myoptions = { "nativecontrolsfortouch": false, controls: true, autoplay: false, width: "640", height: "400", } var myplayer = amp("azuremediaplayer", myoptions); myplayer.src([ { "src": "//amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01- faba6c2206a2/azuremediaservicespromo.ism/manifest", "type": "application/vnd.ms-sstr+xml" } ]); amp("azuremediaplayer").ready(function(){ var myplayer = this; myplayer.play(); }); **html tag** <video id="azuremediaplayer" class="azuremediaplayer amp-default-skin amp- big-play-centered" tabindex="

android - How to access all child elements of a GridView? -

i have gridview showing items of "icon text overlay". on specific event want iterate of items , change text. how can reference items outside of onitemclicklistener ? can somehow execute like: view.findallviewbyid(r.id.itemtext); ? know findall() not exist. item_view.xml: <relativelayout> <imageview /> <textview android:id="@+id/itemtext" /> </relativelayout> main.xml: <linearlayout> <gridview android:id="@+id/simplegridview" /> </linearlayout> code. gridview grid = (gridview) findviewbyid(r.id.simplegridview); grid.setadapter(..); //inside adapter: inflates items r.layout.item_view grid.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { textview item = ((textview) view.findviewbyid(r.id.itemtext)); item.settext("some click text"); } });

how to add preprocess loader in webpack 2 -

i trying add preprocess loader in webpack 3. have installed successfully. not working here's webconfing file var debug = process.env.node_env !== "production"; var webpack = require('webpack'); var path = require('path'); module.exports = { context: path.join(__dirname, "src"), devtool: debug ? "inline-sourcemap" : null, entry: "./js/app.js", module: { loaders: [ { test: /\.jsx?$/, exclude: /(node_modules|bower_components)/, loader: 'babel-loader!preprocess-loader?+debug', // query: { // presets: ['react', 'es2015'], // plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'], // } }, { test: /\.css$/, loader: "style-loader!css-loader!sass-loader" } ] }, output: { path: __dirname + "/src/", f

elixir - how to send message to different user in phoenix framework chat app -

Image
i working phoenix framework create different type chat app. in case, have chat rooms not functioning normal chat room. every user has own room can join room using different devices (mobile, pc, other sources). user has own room , user b has own room, these 2 members not connect single room in normal scenario in real world. now user wants send message user b message data eg: from : :b message : test message this snippet app.js used connect user's specific room : let room = socket.channel("room:"+ user, {}) room.on("presence_state", state => { presences = presence.syncstate(presences, status) console.log(presences) render(presences) }) this snippet back-end join room function /web/channel/roomchannel.ex def join("room:" <> _user, _, socket) send self(), :after_join {:ok, socket} end but stuck in middle because cannot find way send messages between users. eg: cannot identify way deliver user

java - Wait in background while webdriver work -

i have problem selenium webdriver fact want run wait error's message in background, while test page, should not affect total test's time for example tried: private void checkheadererror(){ string errfieldxpath = "path"; scheduledexecutorservice executor=executors.newscheduledthreadpool(1); runnable task = () -> { try { new webdriverwait(getwebdriver(), 0).until( expectedconditions.invisibilityofelementlocated(by.xpath(errfieldxpath))); } catch (exception e) { string errmsg = getwebdriver().findelement(by.xpath(errfieldxpath)).gettext(); assert.fail(errmsg)); } }; executor.schedulewithfixeddelay(task, 0, 4, timeunit.seconds); } but doesn't work honestly, not know put works

printing - IE11 Print preview (not responding) -

i trying print or view "print preview" dialog on internet explorer 11 (windows 10) using browserstack preview windows crashes. works expected in edge browsers though. i have print stylesheet taken h5bp , hiding such things header, footer, ads , embedded (social) media. has got idea might possibly missing here?

Convert C++ class with 150+ variables to Json object -

i codding in c++ , using jsoncpp. have class 150+ variables , know if possible convert variables json @ once. not : myclass.h class myclass { std::string var0; std::string var1; //... std::string var150; } main.cpp int main() { json::value param; param["var0"] = var0; param["var1"] = var1; //... param["var150"] = var150; } thanks tips. one option create structure in google protocol buffers . you'll still need list members once (in .proto file instead of .cpp file) can use protobuf library to convert or json , , has other handy abilities (e.g. iterate on members, convert binary format, use grpc ).

php - How do I prevent the mismatch token error in laravel? -

i started using laravel , it's great. lot of useful functionality etc. have problem csrf_token . session time default 120 minutes , let's log in, , browser tab stays open without me doing 120 minutes , expires, meaning have log in again. when on page after 120 minutes of inactivity, requires user authenticated, using post method, mismatch token exception error. need solve because indeed possibility user leave browser tab open without doing anything. know how solve this? in app/exceptions/handle.php , replace render function 1 : public function render($request, exception $e) { if ($exception instanceof \illuminate\session\tokenmismatchexception) { return redirect() ->back() ->withinput($request->except('password', '_token')) ->witherror('validation token has expired. please try again'); } return parent::render($request, $e); } it redirect same page new token.

multiprocessing - Join two process by pid in Python -

i created 2 process using fork in python as import os import sys pid = os.fork() if pid > 0: # set variable ( lets setting_a ) # lets execute os.waitpid(pid,0) else: pid = os.fork() if pid > 0: # set other variable ( lets setting_b ) # let execute os.waitpid(pid, 0) else: sys.exit(0) # common workflow problem: lets assume script run setting_a takes 10 sec . while same script run setting_b takes 2 min . want run 2 instances of script 2 different setting in parallel. make sure parent process wait child finish, used os.waitpid() , made sequential execution. run first setting b , a . how can maintain parallelism , parent process wait until child process finish. tried searching join() process() class in python. there way can join these process pid without affecting change.

RDLC Expression counting all rows where value is True -

i need count values "true", have 2 datasets. saw lot of tutorials 1 dataset , seems easy because thay can name value , works. thing tried =count(iif((fields!usvojena.value, "datasettackednevnogreda") = "true", 1, nothing)) fields!usvojena.value returns true or false "datasettackednevnogreda" name of second dataset i error message: the value expression textrun ‘textbox8.paragraphs[0].textruns[0]’ has scope parameter not valid aggregate function. scope parameter must set string constant equal either name of containing group, name of containing data region, or name of dataset. also reason fields!usvojena.value underlined red color in expression windows you can use sum instead of count eliminate including "nothing" value (and count anyway) - add 1 have fields!usvojena.value = true , 0 if it's not. also, if field boolean true/false, can way: =sum(iif(fields!usvojena.value, 1, 0)) if field strin

scala - How to propagate error in future to parent actor -

i try understand failure handling akka , futures . example have parent , child actors. child actor have 2 failure cases: case 1) error happens while message processing case 2) error happens inside future i need propagate error parent in both cases, in second case it's not happens. what's doing wrong? import akka.actor.supervisorstrategy.{decider, stop} import akka.actor.{actor, actorref, actorsystem, oneforonestrategy, props, supervisorstrategy} import akka.testkit.{testkit, testprobe} import org.junit.{after, before, test} import scala.concurrent.future import scala.util.{failure, success} class parent(_case: string, probe: actorref) extends actor { val child = context.actorof(props(new child(_case)), "mylittlechild") final val defaultstrategy: supervisorstrategy = { def defaultdecider: decider = { case ex: exception => probe ! ex stop } oneforonestrategy()(defaultdecider) } override def supervisorstr

cmdlet - Powershell - Why some properties have related parameters -

i'm in process of learning powershell (v5 exact) , don't seem follow logic behind object properties , parameters. if take: get-service | gm we can see there "name" aliasproperty: name aliasproperty name = servicename but (confusingly) have parameter called "-name" allows filtering on given name. for example: i can access name property doing: (get-service).name and presumably filter piping it. but can do get-service -name "filter" my first question be, property related parameter? parameter given sort-of related helpful shortcut filtering on "name" property? secondly, ask why there isn't corresponding parameter every property. example: (get-service).servicetype doesn't have corresponding parameter: get-service -servicetype thanks. no. parameters arguments accepted cmdlets. properties things belong object (input/output cmdlet) you can use where-object more selecti

How to trigger multiple down stream jobs in jenkins dynamically based on some input parameter -

scenario: want trigger few down stream jobs(job , job b ....) dynamically based on input parameter received current job. import hudson.model.* def values = ${configname}.split(',') def currentbuild = thread.currentthread().executable println ${configname} println ${sourcebranch} values.eachwithindex { item, index -> println item println index def job = hudson.model.hudson.instance.getjob(item) def params = new stringparametervalue('upstream_job', ${sourcebranch}) def paramsaction = new parametersaction(params) def cause = new hudson.model.cause.upstreamcause(currentbuild) def causeaction = new hudson.model.causeaction(cause) hudson.model.hudson.instance.queue.schedule(job, 0, causeaction, paramsaction) } how this? getting comma separated list upstream system , splitted them individaul string internally jobs. making call passing each individual strings.

c# - Runnings time in seconds in a Label -

i show current time in label. time should updated in realtime. currently do: txtdatetime.text = datetime.now.tolocaltime().tostring(); edit i'm using visual studio 2017 .net framework portable class library develop crossplatform mobile application. sorry if unclear in making question use timer , update label every second: // declare timer field prevent garbage collection timer t = new timer(); // set values , event handler in form load (or similar) t.interval = 1000; t.tick += (x,y) => { txtdatetime.text = datetime.now.tolocaltime().tostring(); }; t.start();

intellij idea - java.lang.UnsatisfiedLinkError: Failed to load OneTick Java API native library libjomd.so/jomd.dll -

i trying run application uses onetick. needs dll files work, 1 of jomd.dll. working in intellij. put file location in vm arguments list : -djava.library.path=c:\users\one_tick\bin but shows me following error: exception in thread "main":org.springframework.beans.factory.beancreationexception: error creating bean name 'a' defined in class path resource [x/y/z/a.xml]: bean instantiation via constructor failed; nested exception java.lang.unsatisfiedlinkerror: failed load onetick java api native library libjomd.so/jomd.dll. path library can specified via -djava.library.path command line option or via ld_library_path/path. if library in path, ensure dependencies loadable, , java binary compatible library (e.g. ensure don't load 64-bit library within 32-bit java or vice versa).c:\users\one_tick\bin\jomd.dll: can't find dependent libraries. but don't error when make "c:\users\one_tick\bin" current working directory. this tried: put

javascript - Turning string with line jumps into li in AngularJS -

Image
i have object property (string) coming database line jumps, looking this: right now, when display in frontend shows this: 1223123 2121 3223 54545 1221 1221 what need this: <ul> <li>1223123</li> <li>2121</li> ... </ul> is there way turn such string li using filter? thought string replace, assume wouldn't work. something along these lines should work: <ul> <li ng-repeat="artist in artsts.split('\r')"> {{artist}} </li> </ul>

git - How do I merge one commit of a branch to another branch - use case -

Image
i have branch access-permission @ local in github remote. made changes it, committed locally , pushed access-permission remote branch. now require merge commit remote branch called staging . not have staging branch locally. i may possibly clone remote staging branch local, checkout it, merge access-permission , commit remote staging branch. right way go? there way without having staging branch locally? i don't have enough experience using git got confused. please advise. update: what have described is correct way this. you'll have have local copy of staging branch in order merge between 2 branches. it place handle possible conflicts durring merge.

jquery Firefox doesn't fire window.onload -

the following code works fine on chrome in fire fox. works once , if refresh page won't work again. idea on how fix that <script type="text/javascript"> window.onload = new function() { $(document).on('click', 'div', function() { if ($(".ystq_buddy").hasclass("ystq_swipe-right") || $( ".ystq_buddy" ).hasclass( "ystq_swipe-left")) { $(document.forms['f1']).submit(); } }); }; </script> it works fine when used $( window ).load(function() { thanks efforts.

java - Unable to start oreitndb with yajsw -

we trying start orientdb of yajsw wrapper. wrapper tries start orientdb gets shutdown. when try start orientdb runconsole.sh, starts , terminated immediately. no error/exception thrown in logs. this orientdb wrapper.conf - #******************************************************************** # java executable properties #******************************************************************** wrapper.control=loose # copy java.exe <tmp>/java_<customprocname>_nnnn.exe #wrapper.java.customprocname= #******************************************************************** # working directory #******************************************************************** wrapper.working.dir=/home/atrium/orientdb-community-2.1.2/bin # java main class. # yajsw: default "org.rzo.yajsw.app.wrapperjvmmain" # not set property unless have own implementation # wrapper.java.mainclass= #******************************************************************** # tmp folder # yajsw creates t

Multiple tool-tip showing in kendo scheduler -

Image
in kendo scheduler multiple tool tip showing in dayview , monthvie mouse hover. please find attachment. i tried hide other tooltip class except current one. function enabletooltip(slctr, posi) { $('.mytooltip').kendotooltip({ autohide: true, position: 'top', show: function () { var = this, tooltips = $("[data-role=tooltip]"); tooltips.each(function () { var tooltip = $(this).data("kendotooltip"); if (tooltip && tooltip != that) { tooltip.hide(); } settimeout(function () { tooltip.hide(); console.log("timeout"); }, 6000); }); } }); } can 1 please he

Error Max values per tag limit exceeded InfluxDB -

i facing max values per tag limit exceeded issue when trying write 200k points influx db (version 1.2.4) through java specifying batch size , poll interval. have set max-values-per-tag = 0 in /etc/influxdb/influxdb.conf still facing following issue. severe: batch not sent. data lost org.influxdb.influxdbexception: {"error":"partial write: max-values-per-tag limit exceeded (100453/100000): measurement=\"samplemeasurement\" tag=\"sampletag\" value=\"samplevalue99195\" dropped=806"} @ org.influxdb.impl.influxdbimpl.execute(influxdbimpl.java:511) @ org.influxdb.impl.influxdbimpl.write(influxdbimpl.java:312) @ org.influxdb.impl.batchprocessor.write(batchprocessor.java:248) @ org.influxdb.impl.batchprocessor$2.run(batchprocessor.java:278) @ java.util.concurrent.executors$runnableadapter.call(executors.java:511) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.schedul

android - Passing selected value to another activity (using recycleview/textView) -

i'm making pokedex app , i'm stuck @ passing data of selected pokemon activity(to show more details). problem keeps sending same value other activity(the first value in list, in case bulbasaur) if select different pokemon. the list consists of recycleview, textview , imageview.and use value of textview data send other activity. so want pass correct name(textview) selected pokemon other activity click image. , im not sure i'm missing. thanks in advance! adapter code public class pokemonlistadapter extends recyclerview.adapter<pokemonlistadapter.viewholder>{ private arraylist<pokemon> dataset; private context context; public pokemonlistadapter(context context){ this.context = context; dataset = new arraylist<>(); } @override public viewholder oncreateviewholder(viewgroup parent, int viewtype){ view view = layoutinflater.from(parent.getcontext()).inflate(r.layout.image_pokemon, pare

vba - Which would yield better performance in general? -

i have small dilemma. know, defining variables types , avoiding usage of variants obvious performance trick. problem i'm trying write library of routines work implicitly-typed arguments (basically variants). take example: sub test(a string) ' implicit byref debug.print end sub nothing crazy, right? if did test "abc" , works expected. problem arises when try pass value array ( test array("abc")(0) ) or return value routine while chaining. i'd compile error saying "byref argument type mismatch". i need these routines take in various types of arguments , typecast them when possible. thought of following: sub test(byval string) ' explicit byval debug.print end sub now works fine. ultimately, question is: performance gain achieved explicitly defining argument types worth tradeoff of performance loss imposed making copies of argument values use of byval ? know there cases 1 better other, general usage library, method more

java - JVM how to increase constant pool limit -

Image
after trying deploy app, build failed , following error returned. file size exceeds configured limit (2560000), code insight features not available i deleted several unecessary libraries , components error still exists. remaining stuff in project needs there. know limit of java constant pool 65535, there way possible increase limit? r.java file (unnecessary constants won't go away) public static final class style { public static final int alertdialog_appcompat=0x7f0900a2; public static final int alertdialog_appcompat_light=0x7f0900a3; public static final int animation_appcompat_dialog=0x7f0900a4; public static final int animation_appcompat_dropdownup=0x7f0900a5; public static final int apppreferencefragmentcompatstyle=0x7f0900a6; public static final int apppreferencetheme=0x7f0900a7; public static final int apptheme=0x7f0900a8; public static final int base_alertdialog_appcompat=0x7f0900a9; public static final int base_alertdialo