Posts

Showing posts from March, 2015

Playing multiple videos on the same player using html and php -

i have code playing multiple videos in single folder don't know error is page1.php <html> <body> <head> <title>video tests</title> </head> <h5>video list: </h5> <ul> <?php $filelist = scandir("videolibrary"); foreach($filelist $key=>$video){ if($key >1){ echo '<li><a href="page2.php?video='.$key.'" >'.$video.'</a </li>'; } } ?> </ul> </br> </body> </html> page2.php <html> <body> <?php $current_video = $_get['video']; $filelist = scandir("videolibrary"); foreach($filelist $key=>$video){ if($key >1){ if($key==$current_video){ $current_video_src = $video; $next_video = $key+1; $previous_video = $key-1; } } } ?> <center> <video id="myvideo" width="720" height="480"

solr - Apache Tomcat Environment Variables -

when deploy .war file tomcat ide define that: -dsolr.solr.home=/home/vicita/desktop/lucene-solr/solr/solr_h -dsolr.data.dir=/home/vicita/desktop/lucene-solr/solr/solr_h/data however when deploy remote machine have define parameters. book follow says have define $tomcat_home/conf/catalina/localhost within xml file: <context path="/solr" docbase="/usr/share/tomcat/webapps/solr.war" debug="0" crosscontext="true"> <environment name="solr/home" type="java.lang.string" value="/usr/share/solr_h/" override="true"/> </context> by way: /usr/share/solr_h is directory should mention. first thing want know didn't define variable solr.solr.home @ here? second thing .war not find folder , throws error. tried create setenv.sh , put: -dsolr.solr.home=/usr/share/solr_h -dsolr.data.dir=/usr/share/solr_h/data however when tomcat starts says: /usr/share/tomcat/bin/setenv.sh: l

split not working on app engine java and yet works on my Android client -

the split method returns spaces , need return elements of string can pick values want. works fine on android not on app engine. please need html array of strings no spaces. no not duplicate of other question. using right regex "\s+" import com.google.api.server.spi.config.api; import com.google.api.server.spi.config.apimethod; import com.google.api.server.spi.config.apinamespace; import org.jsoup.jsoup; import org.jsoup.nodes.document; import org.jsoup.select.elements; import java.util.arraylist; import java.util.list; import java.util.logging.logger; import javax.inject.named; /** * endpoint class exposing */ @api(name = "myapi", version = "v1", namespace = @apinamespace(ownerdomain = "backend.abokiforex.greatcallie.com", ownername = "backend.abokiforex.greatcallie.com", packagepath = "")) public class rateendpoint { string[] html; private static final logger log = logger.getlogger(rateendpoint.

arduino - Store array of arrays in array -

it possible store bitmap in array in wiring programing language (arduino)? boolean trianglemap[display_height][display_width] = { {0,0,0,1,1,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {1,1,1,1,1,1,1,1} }; boolean squaremap[display_height][display_width] = { {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1} }; boolean symbols[] = {trianglemap, squaremap}; ??? symbols[] = {trianglemap, squaremap}; error: invalid conversion ‘boolean ( )[8] {aka unsigned char ( )[8]}’ ‘boolean {aka unsigned char}’ [-fpermissive] i not know whether possible store trianglemap , squaremap bitmap in symbols array? thanks lot. you not using correct type. boolean symbols[] means "i want array of booleans", while want "an array of booleans matrices. this boolean symbols[][display_he

php - Prestashop 1.6 - How I can get the admin directory name dynamically? -

i want put module in prestashop market place, , make standard can use it. plugin needs know admin directory name dynamically service. i have searched on internet lot of times, didn't find solution issue. you can use _ps_admin_dir_ witch set in [your_admin_dir]/index.php : if (!defined('_ps_admin_dir_')) { define('_ps_admin_dir_', getcwd()); } this constant set when you're on admin context. frontoffice doesn't have knowledge of directory , should not obvious security reason. there's getadminlink method in class link : /** * use controller name create link * * @param string $controller * @param bool $with_token include or not token in url * @return string url */ public function getadminlink($controller, $with_token = true) { $id_lang = context::getcontext()->language->id; $params = $with_token ? array('token' => tools::getadmintokenlite($controller)) : array(); return dispatcher::getinstanc

android - Sync the two mpandroidcharts graphs dragging and zomming -

Image
i using mpandroidchart , have requirement have sync dragging , zooming of 2 graphs, if zoom out, zoom in or drag 1 of 1 graph other graph should zoomed out, zoomed in or dragged same extent on x-axis. example: if drag upper graph 12th point on x-axis lower graph should dragged 12th point on x-axis automatically. guys need need idea how this, enough familiar mpchartandroid library. i wrote function this, calling function of drag , scale listener. working perfectly. private void synccharts(chart mainchart, linechart[] othercharts) { matrix mainmatrix; float[] mainvals = new float[9]; matrix othermatrix; float[] othervals = new float[9]; mainmatrix = mainchart.getviewporthandler().getmatrixtouch(); mainmatrix.getvalues(mainvals); (linechart tempchart : othercharts) { othermatrix = tempchart.getviewporthandler().getmatrixtouch(); othermatrix.getvalues(othervals); othervals[m

.htaccess rewrite rule confusion/conflicts -

i have below rewrite rules setup on site. i' trying set have below different urls. current .htaccess options +followsymlinks rewriteengine on rewritebase / rewriterule ^([^-]*)/$ ?action=$1 [l] rewriterule ^([^-]*)-([^-]*)/$ ?action=$1&id=$2 [l] required urls www.site.com www.site.com/page/ www.site.com/product-1234/ www.site.com/privacy-policy/ the problem second rewrite rule affecting privacy-polcy url shouldn't second rewrite rule specific product pages have product id in it. i'm trying ignore directories exist structure of site under root have below directories don't want rewrite rules affect user shouldn't know these directories. /system/ /tasks/ # catch more specific urls: rewriterule ^product-([0-9]*)/$ ?action=product&id=$1 [l] # ignore requests want files or directories exist: rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # continue less specific: rewriterule ^([^/]*)/$ ?action=$1 [l]

How to access model or views attributes in django settings.py? -

i want update email host user , password, present in database .. don't know how update it. mentioned in settings.py file. this, email_host_user = 'sender_mail@mail.com' email_host_password = 'passxxpass'.... want change dynamically while updating database. my table contain email id , password. may change dynamically based on user requirement. want same in email_host_user , password ... send mail.. django's send_mail (which presume you're using) has 2 parameters auth_user , auth_password , should use these instead of trying change settings send_mass_mail , others have these parameters

Service fabric deploy deprecated files from previous deployment -

when redeploying application on service fabric (using publish-upgradedservicefabricapplication ), why see files previous deployment ? file of application seems not deleted or cached somewhere. for example appversiona includes filea appversionb includes fileb result in target _vm "sf/_app" data directory: first deployment appversiona : got appxx/myservice/code/filea : ok then when deploy appversionb replace appversiona : i got appyy/myservice/code/filea and appyy/myservice/code/fileb failed : expected have fileb ! inside applicationmanifest.xml of application had "1.8-snapshot" applicationtypeversion attribute value. so encounter issue when updating , redeploying snapshot version multiples times. seems in usecase - applicationtypeversion unchanged - sf overrides or append deployment bundle content of previous deployment instead of recreating new 1 scratch (for me it's issue). to fix it, add build timestamp applicati

javascript - How to solve double quote inside double quote syntax error -

i have project have php code, inside have echo html has javascript onclick function() accepts double-quotes. problem echo uses double-quote there's syntax error in code , i'm new php don't know how solve this. here code: echo " <span class = 'username'>".$row['username']."</span> <form name = 'matchcreator' class='amount' action='arena.php' method ='post'> <input name = 'm-maker' type = 'number' class='price' min='5' max='100' value='5'/> <div class = 'review'> <p>review</p> </div> <button id ='send' type = 'button' onclick="confirm.render('yes','no')">send challenge</button> </form> "; echo "<br>"; i know synt

jboss - primefaces does not render f:selecteditems -

here mycode: there might mistakes doing right, thinking problem in java code can please throw light, trying render radio values. <p:selectoneradio id="firstbill" value="#{myclass.myfee}" label="what do?"> <f:verbatim> <f:selectitems value="#{myclass.listmyfee}"/> </f:verbatim> </p:selectoneradio> @name("myclass") public class myclass { private string fee; private map<string, string> listmyfee; public myclass(){ //constructor listmyfee = new linkedhashmap<string, string>(); listmyfee;.put("yes", "yes"); listmyfee;.put("no", "no"); } public map<string, string> getlistmyfee() { return this.listmyfee; } , set fee written your bean-code wrong, need f:selectitems list of list<selectitem> . it this: list<selecti

rtmp - Azure Media Services live streaming latency -

i have created channel on azure media services, correctly configured rtmp channel , streamed live video android + ffmpeg libraries. the problem client end-point latency. i need maximum latency ~2 seconds, have ~25 seconds! i'm using azure media player in browser page stream content. do know configuration of client/channel can reduce latency? thanks as pointed , there few factors affects latency. total delay time = time push video client server server processing time latency delivering content server client. check https://azure.microsoft.com/en-us/documentation/articles/media-services-manage-origins/#scale_streaming_endpoints see how can minimize #3 mentioned above configuring cdn , scaling streaming end units. given these 3 components, don't think @ stage able archive less 2 seconds end end delay globally android client browser client.

ios - Missing dSYM files in Fabric Crashlytics -

Image
this question has answer here: crashlytics: “we're missing dsym process crashes” 5 answers since yesterday try configure twitter crashlytics in ios app. have problem w dsyms files. fabric dashboard show me message "we missing dsyms files" uploaded files online manager (redirect message) , message shown: but if go dashboard message system missing dsyms files shown again.. , again. have do? i ran same issue. tried following of steps crashlytics recommends, including 1 @mike helpfully posted, no avail. i found workaround , posted here: https://stackoverflow.com/a/35374388/2397068 . need download dsym itunes connect.

Dialog with permissions language on Chrome extension update -

i know in case when extension updated , requires additional permissions compared installed version, dialog permission warnings shown. my question is: dialog going shown if permissions removed compared previous extension version? is dialog going shown if permissions cutted off comparing previous extension version? if permissions decrease, no dialog shown. interesting fact: chrome still consider permissions granted on installs had broad-permissions version before. so if next version reintroduces same permission, users had restricted-permission version first installed version notified. makes easier (but still not trivial) recover accidental permission deletion. from source code (thanks sungguk lim link): // extensions can silently upgrade less permissions, , // silently upgrade version adds these permissions back. // extension release new version // removes "omnibox" permission. when user upgrades, chrome // still remember "omnibox"

apache spark - Transforming an RDD to DataFrame -

hi new spark , trying transform rdd dataframe.the rdd folder many .txt files in it, , each 1 of them have paragraph of text.assume rdd this val data = sc.textfile("data") i transform data dataframe this +------------+------+ |text | code | +----+-------+------| |data of txt1| 1.0 | |data of txt2| 1.0 | so column "text" should have raw data of each txt file , column "code" 1.0 appreciated. val data = sc.textfile("data.txt") *// schema encoded in string* val schemastring = "text code" *// import row.* import org.apache.spark.sql.row; *// import spark sql data types* import org.apache.spark.sql.types.{structtype,structfield,stringtype}; *// generate schema based on string of schema* val schema = structtype( schemastring.split(" ").map(fieldname => structfield(fieldname, stringtype, true))) *// convert records of rdd (data) rows.* val rowrdd = data.map(_.split(",")).ma

javascript - How to run success function with JQuery getJSON? -

i want push data array, unsure how go due ajax's asychronisity. i can't seem find complete examples online of way done getjson. i've been following documentation here no luck/ i have tried: var jsonltdlng="https://maps.googleapis.com/maps/api/geocode/json?address=" + addressval; var latlng; $.getjson(jsonltdlng, function (data) { var lat = data.results[0].geometry.location.lat; var lng = data.results[0].geometry.location.lng; latlng = {lat: lat, lng: lng}; }).done(function() { markerlocations.push(latlng); })//end json and: var jsonltdlng="https://maps.googleapis.com/maps/api/geocode/json?address=" + addressval; var latlng; $.getjson(jsonltdlng, function (data) { var lat = data.results[0].geometry.location.lat; var lng = data.results[0].geometry.location.lng; latlng = {lat: lat, lng: lng}; markerlocations.push(latlng); }); and variations of no results. would know correct way of doing , can point me in right

c++ - adding namespaces to XML with boost -

i'm trying generate xml using boost. going fine far, xml gets generated needs have namespace. so instead of <name>"harry"</name> <ns1:name>"harry"</ns1:name> is there way add namespace xml boost without manually adding "ns1" every line? is there way add namespace xml boost without manually adding "ns1" every line? assuming use rapidxml, no cannot. extend rapidxml support or obtain copy of parser support (see sehe's answer). there even fork of rapidxml supports (you have replace it). or add namespace manually adding string.

java - Android: Swipe to refresh gets stuck on a recycler view with view pager -

here xml code <framelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/flipper"> <android.support.v4.widget.swiperefreshlayout android:id="@+id/refreshlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/headerlayout" android:background="@color/background_color" android:visibility="visible"> <android.support.v7.widget.recyclerview android:id="@+id/list_appointment" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v4.widget.swiperefreshlayout> <relativelayout android:id="@+id/emptyview" android:layout_width="wrap_content&q

statistics - How can I export a counter that resets every restart to bosun and trust the absolute number? -

i sending counter can reset @ point. sent counter every 5 seconds don't reset every 5 seconds, when app restarts, regularly. i need able tell how many impressions did server got last week, can't sum() because bosun add 10, 12, 15, 25, 0, 1, 5, 10.... so, take in account rate calculation, not summing or other thing. would bosun handle better if restarted counter every time send it? seems easier, docs on bosun/opentsdb state not necessary , not it. opentsdb should automatically handle sum/average aggregation of counters when use them rate instead of raw gauge. takes 2 sample points , calculates difference, giving total "impressions" between 2 sample points. note may change value "per second" since standard opentsdb. whenever second value lower first, opentsdb disregard datapoint , wait next data point sent before continue rate calculations. reason should try , minimize counter resets or overflows if possible (anything less hour may cause no

html5 - Canvas 2D game framework -

Image
this more investigation rather question. i receive suggestions regarding framework should chose fulfill following needs: quick rendering objects in 2d game engine objects interacting(bullet hit unit) built in ability work data received websockes thank in advance. try : with visual js can setup page this. this onpage-editor , visual view . run cmd linux users server/node editor.js windows cmd . see video : https://www.youtube.com/watch?v=mvp-jsaha94&feature=youtu.be you : 99% canvas 2d add new object create webcam component create coallision (basic - rect) create textbox (virtual keyboard) create particle ( works animation component) atach player (basic movement) localstarage multipeer ( share object in real time) tools (windows gui): visual-js ge beta 1 comes visual editor , coding . video tutorial implemented : quick code insert source code editor run test (chrome,firefox,opera) in new update safari win implemented. add new game ob

php - How to install Predis on app service? -

Image
i using azure app service application requires predis extension installed on server, how can have installed on app services? application in php. you can package predis sdk in application , deploy azure web apps service via git or ftp. create php-mysql web app in azure app service , deploy using git more info. additionally, can configure predis sdk in composer.json. "require": { "predis/predis": "1.*" } then install composer extension in azure web apps service. when deploying azure via git, azure deployment task run composer install command install dependencies , composer commands configured in file. you can refer how install composer on app service? installing composer extension additionally, if leverage redis cache in azure, should enable non-ssl endpoint php integration @ first: and code snippet: require 'vendor/autoload.php'; $client = new predis\client('redis://{your_redis_service_name}.redis.cache.w

amazon web services - Puppet apache configuration file on ubuntu ec2 -

i using puppet provision aws ami using packer , launch ami. puppet configuration , package installations upon baking ami includes installing , configuring apache , wsgi. time launch ami application (a flask application) have been downloaded , configured puppet apache configuration file @ /etc/apache2/sites-available/xxxx.conf . make use of puppet template configure apache configuration file , such ruby template (xxxx.conf.erb) ,the apache configuration template file looks : <virtualhost *:<%= @port -%>> servername <%= @servername %> serveradmin admin@example.com wsgiscriptalias / /var/www/porfolio/xxxxx.wsgi <directory /var/www/porfolio/> order allow,deny allow </directory> alias /static /var/www/porfolio/static <directory /var/www/porfolio/static/> order allow,deny allow </directory> errorlog ${apache_log_dir}/error.log loglevel warn customlog ${apache

office365 - Presence info of Skype for Business Online (Office 365) user -

sorry if giving details , if not in sync together. my question is, is there way can show presence information of skype business online (office 365) user our web application? in our web application want provide ability our worker users, using can see status or chat shift super-wiser users. don't want configuration on-premise skype business servers, want through cloud. using html 5, javascript, c# development purpose. we have office 365 subscription have configured azure active directory few users. think we'd need perform authentication using microsoft graph api. i searched on google , found that, * are applications created skype web api able communicate skype business online (o365) users? ans: skype web api apps require local on-premises lync 2013 or skype business server. online capability in roadmap not have release date. * documentation of skype developer platform list various sdk's , api's communicate skype. lync 2013 sdk suppo

Jquery add class in a class function using "this" as reference -

i'm trying use class reference addclass removeclass jquery (this). need universal reference class i'm adding dynamic elements page , need elements use function. when reference element id works great. when reference element class can't seem modify class or input's value. html <input id="part" size="15" type="text" class="part" name="part" value=""/> jquery (response okay; addclass, removeclass, this.val(data), not okay) $(document).on('blur', '.part', function(){ var oldnumber = $(this).val().touppercase(); $.post("part-interchange.php",{ part:$(this).val() } ,function(data) { //no data add class red remove green if (data=='no') { $(this).removeclass('shadechange'); $(this).removeclass('shadegood'); $(this).addclass('shadebad'); } else if (data=='yes')

Umbraco Razor code breaks when wrapping a Div round the multiURL picker -

when wrapping multiurl picker within div tag, breaks page, has seen type of behaviour before when creating new templates in umbraco? if has experienced before , can share fix, appreciated. @inherits umbraco.web.mvc.umbracotemplatepage @using archetype.models; @using archetype.extensions; @using rjp.multiurlpicker.models; @{ layout = "master.cshtml"; } <div class="container"> <div class="row"> <h1>@umbraco.field("pagetitle")</h1> <p>@umbraco.field("pagebodytext")</p> @foreach (var fieldset in model.content.getpropertyvalue<archetypemodel>("box")) { <div class="this-div"> <h3>@fieldset.getvalue("boxtitle")</h3> <img src="@umbraco.typedmedia(fieldset.getvalue("boximage")).url" /> var multiurlpicker = fieldset.getvalue<multiurls>("boxlink"); if (multiurlpicker.any()) { <ul> @foreac

Blender rescaling rendered images issue -

Image
i rendered image in blender. now, issue is, when down scale image quality seems lower can identify individual pixels. i'm not entirely sure if aliasing (and if is, nice if explain how caused aliasing) , whether setting anti-aliasing in blender work. see below: before after any appreciated, thanks. your answer isn't directly related blender, since you're resizing image inside microsoft paint, program manage how pixels stored/rendered on screen , in of cases, shrinking or increase resolution of image, mean you're going lose detail/quality, try image manipulation program , check results, there algorithms perform resampling of image, each of them performs mathematical operation on pixel, approximation, multiplication between neighbors pixels , on. different programs have different features this.

oracle - SQL Conditional SELECT with COALESCE (possible issue with grouping or table joins) -

apologies in advance length of question: i working on query display data pull different tables depending on facility requesting data. we maintain many statistics individual product lines, , each facility able view data on line level; facilities organize products in groups department , group departments "value stream" (just layer in hierarchy). what able display data in highest group available (facilities value streams list of streams facility, facilities have product lines view list of products, etc). i have used coalesce function this, interested in testing null values determine organizational group facility uses. unfortunately, necessary data on 6 different tables, requiring few joins. have added additional parameters each join attempt ensure joins correct. the query functions correctly facility not use streams or departments (1 in below example); list of products , respective scores generated. the query not provide desired results other levels. facility o

android - Invalidating and ImageView outside of the MainActivity thread -

my mainactivity's contentview/view can refresh using invalidate() anywhere after calling: setcontentview(r.layout.activity_main); but if call dialog in item select: @override public boolean onoptionsitemselected(menuitem item) { switch(item.getitemid()){ case r.id.menu_tools: showdialog(); return true; ... doing not refresh imageview inside dialog: public class toolsettingsdialog extends dialog { ... private void updatepreview() { imageview image = (imageview)findviewbyid(r.id.widthimageview); bitmap bitmap = bitmap.createbitmap(400, 400, bitmap.config.argb_8888); canvas canvas = new canvas(bitmap); bitmap.erasecolor(color.white); drawing d = null; d = box.getdrawing(); s.draw(paint, canvas); image.setimagebitmap(bitmap); image.invalidate(); } i've been looking around , can't seem understand how invalidate in different thread ui one. dialogs drawn on ui

How to add table to custom post type as custom field in wordpress -

hi have tried tablepress, wp_table_reloaded plugins. feel complicated naive user add table adding shortcode each custom post's content there many custom posts in websiste. want table should added each custom post type add custom fields each custom post type,then adding value each field. please me!!! take @ add_meta_box function: http://codex.wordpress.org/function_reference/add_meta_box here's code used in recent project, believe should able adapt meta box add table. add_action( 'admin_menu', 'create_meta_boxes' ); function create_meta_boxes() { add_meta_box( 'author_info', 'auteur info', 'author_info_meta_box', 'portfolio', 'normal'); } function author_info_meta_box( $object, $box ) { ?> <p> <label for="auteur-meta">auteur</label><br /> <input type="text" name="auteur-meta" id="auteur-meta" style="width:100%;" v

android - min3D library - quaternion rotation issue -

Image
i rendered 3d model using min3d library in application. used quaternion data (x,y,z,w) rotation , flipping. the rotation perfect front face , when flip opposite face rotation becomes opposite actual direction. mean "on opposite face", when rotate right, cube rotates left , vice-versa. the code used: @override public void initscene() { light light = new light(); light.position.setallfrom(scene.camera().position); scene.lights().add(light); scene.backgroundcolor().setall(0xffffff); try { iparser parser = parser.createparser(parser.type.obj, getresources(), "---:raw/cube_obj", true); parser.parse(); cube = parser.getparsedobject(); cube.scale().x = cube.scale().y = cube.scale().z = .08f; cube.position().x = .3f; scene.addchild(cube); scene.camera().target = cube.position(); mdoplotting =true; } catch (outofmemoryerror e) { e.printstacktrace

tomcat - log4j2.xml is overriden. How to stop it? -

Image
i have tomcat server , in tomcat server, there 3 projects, each having log4j2.xml configuration file. tomcat has own log4j2.xml file well. when projects started, log4j2.xml file of tomcat taken , others ignored (or overriden). the version of tomcat server 7.0.67 , version of log4j 2.5. how can achieve log4j2.xml files considered? i found answer own question. that required 2 steps, adding log4j-web jar classpath. i configure web.xml file of web applications in tomcat server. for more detailed solution, click here

wordpress - How to add image link as hyperlink to all images in content using preg_replace? -

i want change hyperlink of images post in content image link. can edit link using function add_image_responsive_class($content) { global $post; $pattern ="~<a .*?>\s*<img(.*?)class=\"(.*?)\"(.*?)>\s*</a>~i"; $replacement = '<a href="$1"><img$1class="$2"$3></a>'; $content = preg_replace($pattern, $replacement, $content); return $content; } add_filter('the_content', 'add_image_responsive_class'); but cant copy image link hyperlink. for example: now have this: <a href="http://www.mywebsite.com/mypage"><img src="imagelink"></a> i want change to: <a href="imagelink"><img src="imagelink"></a> okay, there few ways can this. i'll show 1 easy way, know can customize down finer granularity. process same, though. basically we're going split string chunks , save each chun

Copy/Clone all values from a List to another in a C# -

i have class public class car() { public string name; public string model; } and have property list<car> carsa = new list<car>(); carsa.add(new car(){name = "verna",model="hyundai"}); carsa.add(new car(){name = "x1",model="bmw"}); and have property list<car> carsb = new list<car>(); now want add clone/copy entries carsa carsb without taking carsa properties current instances (i.e. want create new object each entry , add it). something foreach(var car in carsa) { car newcar =new car(); newcar.name = car.name; newcar.model = car.model; carsb.add(newcar); } what if don't want implement icloneable , don't have copy contructor? you consider linq solution: list<car> carsb = (from c in carsa let = new car() { name = c.name, model = c.model } select a).tolist(); since name , model of string type (which immutable),

python - I need some assistance writing to a excel file -

i programming task in user enter sentence (no punctuation), , program store words in list, , replace each word position of word in list created. not have of idea how approach this, new python, assuming should first store words in excel database , position them in list. if have appreciate it, thanks. for more information task, view screenshot: task details here quick example how it. remember own work, use learning. sentence = input("write sentence: ") sentence_array = sentence.lower().split(" ") # split lowercased sentence array individuals = [] # list individual words x in range(0, len(sentence_array)): # loop find individual words if sentence_array[x] not in individuals: # if word not picked already... individuals.append(sentence_array[x]) # ...append individuals list positions = [] # list contains positions of words x in range(0, len(sentence_array)): # loop append positions list positions.append(individuals.index(sentence_array

java - Why use @Transactional Jboss Seam -

i'm trying understand why need use @transactional in cases, let's see. if use method without @transactional annotation jboss return on log: "close connection yourself. closing connection you". public void dosomething() { ((session) em.getdelegate()).dowork(new work() { @transactional(transactionpropagationtype.never) public void execute(connection connection) throws sqlexception { stringbuilder sqlsp = new stringbuilder(); sqlsp.append("{ call "); sqlsp.append("myprocedure"); sqlsp.append("(?)}"); connection.setreadonly(true); callablestatement cs = connection.preparecall(sqlsp.tostring()); cs.setint(1, 1020); cs.execute(); //force exception , jboss show "closing connection you" throw new myexception("fatal err

php - Session data lost on Woocommerce ajax call -

i'm working on woocommerce plugin add vars in session on "add cart" action, , use vars later when order completed , order confirmation email. basically workflow following: on woocommerce_add_to_cart action, set session vars. add_filter('woocommerce_add_to_cart', array(&$this->wc, 'add_to_cart'), 10, 1); public function add_to_cart($cart_item_key) { if(!isset($_session['tickets'])) { $_session['tickets'] = array(); } $_session['tickets'][$cart_item_key] = array(); foreach($_post $key => $value) { if(preg_match('#^ticket_#', $key)) { $_session['tickets'][$cart_item_key][$key] = $value; } } } on woocommerce_email_after_order_table , use vars add informations confirmation email. add_action('woocommerce_email_after_order_table', array(&$this->wc, 'email_after_order_table'), 10, 1); public function email_after_or

How to separate comma separated values in R in a new row? -

i have dataset follow: col1 col2 1,2,3 b ["1","2"] c 4 i want output as: col1 col2 1 2 3 b 1 b 2 c 4 is possible in r? if yes, how? you try csplit "splitstackshape" package: library(splitstackshape) csplit(as.data.table(mydf)[, col2 := gsub("[][\"]", "", col2)], "col2", ",", "long") # col1 col2 # 1: 1 # 2: 2 # 3: 3 # 4: b 1 # 5: b 2 # 6: c 4 of course, i'm highly partial csplit , can use "dplyr" , unnest "tidyr": library(dplyr) library(tidyr) mydf %>% mutate(col2 = strsplit(gsub("[][\"]", "", col2), ",")) %>% unnest(col2) or "data.table": library(data.table) as.data.table(mydf)[, list( col2 = unlist(strsplit(gsub("[][\"]", "", col2), ",&

model view controller - Get value from cookie mvc -

i set value cookie in 1 mvc controler this httpcookie accesstoken = new httpcookie("accesstoken"); accesstoken.values["accesstoken"] = "cb7ca44ff81324186724867668572a8f"; response.setcookie(accesstoken); when value cookie in controler this httpcontext.request.cookies.get("accesstoken"); or this request.cookies["accesstoken"].value i accesstoken=cb7ca44ff81324186724867668572a8f i want value without key, doing wrong? you adding key-value pair accesstoken cookie. if storing 1 value , don't need dictionary structure, can use httpcookie.value property. accesstoken.value = "cb7ca44ff81324186724867668572a8f"; request.cookies["accesstoken"].value // output 'cb7ca44ff81324186724867668572a8f' update : if want store multiple key-value pairs did initially, then: var accesstoken = new httpcookie("accesstoken"); accesstoken["somekey1"]

android - Custom Count Up Timer -

i need count timer in application. browsed many forums subject, not find anything. understood can chronometer, have 2 problem chronometer: i cannot using chronometer in service because chronometer needs layout. i cannot initialize chronometer count more 1 hour. my code: stopwatch = new chronometer (mainactivity.this); starttime = systemclock.elapsedrealtime(); stopwatch.start(); stopwatch.setonchronometerticklistener(new chronometer.onchronometerticklistener() { @override public void onchronometertick(chronometer arg0) { countup = (systemclock.elapsedrealtime() - arg0.getbase()) / 1000; string astext = (countup / 60) + ":" + (countup % 60); log.i("t", astext); } }); you can use countdowntimer in reverse , time elapsed. long totalseconds = 30; long intervalseconds = 1; countdowntimer timer = new countdowntimer(totalseconds * 1000, intervalseconds * 1000) { public void ontick(long millisuntilfinished)

Not being able to use Json data from php page in jquery -

Image
i'm trying parse json data sent php page using jquery in result : { i don't know how fix it, i'm creating json data in php below code : $load_op_cm = $dbm -> runquery("select * at_ops_cmnts op_id='$op_id'",true,false); $row = mysqli_fetch_assoc($load_op_cm); $j_result = json_encode($row); echo $j_result; and i'm trying parse data using jquery i'm using jquery post method send data , response , , i'm trying part of data useful me : cm_1_1 : 1 not 1 of cm_ variables values. when show response in html format it's : this jquery code : $(function(){ var vop_id = localstorage.getitem('op_id'); $.post("requests/ops.php", //required url of page on server { // data sending request server load_op_cm : true, op_id : vop_id }, function(response){ // required callback function

neo4j - {"SyntaxException: Invalid input '{': expected an identifier character, whitespace -

vb.net program loads few thousand nodes , set relationships between them. i'm using neo4j c# client (version 1.1.0.8) one of commands theconnection.graphclient.cypher.match( "(user1:startingpoint)", "(user2:committee)" ).where( function(user1 startingpoint) user1.id = knowsid ).andwhere( function(user2 committee) user2.id = knownid ).create( "user1-[r: knows ]->user2" ).executewithoutresults() for various business logic reasons want match nodes fecidnumber (it's string, in example 'c00530767') instead of id. changed knownid long string user2.id = knownid this gives me following query theconnection.graphclient.cypher.match( "(user1:startingpoint)", "(user2:committee)" ).where( function(user1 startingpoint) user1.id = knowsid ).andwhere( function(user2 committee) user2.fecidnumber = knownid ).create( "user1-[r: knows ]->user2"

java - how can I overwrite an object in matlab? -

i have loop in want create object. must share same name each loop. like for i=1:100 car=car(args(i)) %in loop stuff car end the problem @ second iteration matlab tries access element car(args(i)) instead of calling costructor of class car. this error arg=ss error using subsindex function 'subsindex' not defined values of class 'ss'. in java i'd call ''new'' parameter, like car=new car(args); //do stuff car istance car= new car(args); //do stuff new car istance i can't allocate array of ''car'' since each istance several hundreds of megabytes. tried looking keyword similar new in matlab had no luck. the problem you're calling variable same name class. first time define car=car(); , car starts refer instance, rather class, , subsequent calls car() not call class constructor, try access index of object car (as if array, hence error subsindex ). you have careful in matlab not shadow built-in fu

SQL Conversion failed when converting the varchar value to data type int -

i have query: select c.customerid, q.question_id, q.department, c.duedate homefront.dbo.tpm_questions_default q left outer join homefront.dbo.customerquestions c on q.question_id = c.questionid inner join tblcustomers t on convert(int, convert(varchar(max), t.customer_no )) = c.customerid c.duedate <= getdate() , c.datecompleted not null i added in inner join tblcustomers t on convert(int, convert(varchar(max), t.customer_no )) = c.customerid now error: conversion failed when converting varchar value 'c000432' data type int. you converting (casting) column containing appears character values int values convert(int, convert(varchar(max), t.customer_no )) since value c000432 not valid int , getting error. there's several things consider: is customer number supposed char / varchar data type , if so, non integer characters expected / allowed in data? if not: has incorrect data snuck in (the c character

ruby - How do i display category images and also link them to items under that category am using shoppe rails -

i want display category images respective link items under category in shoppe using rails 4 , have tried far gives me : name error or no method error here's code looks like: <div class="col-sm-4 col-md-8 col-md-4"> <ul class="list-inline"> <% shoppe::productcategory.all.each %> <div class="portfolio-item "> <div class="portfolio-img"> <%= image_tag @product_category, class: "port-item" %> <div class="portfolio-img-hover"> <link_to </div> <!-- /.portfolio-img-hover --> </div> <!-- /.portfolio-img --> <div class="portfolio-item-details"> <div class="portfolio-item-name"> </small> <% end %> i created productscategory controller empty

Are FOR loops with char iterators in C possible? -

i'm having problem using unsigned char iterator. using following code results in being stuck inside loop. the output looks this. unsigned char i; char * arr; int * freq; arr = (char *)(malloc(256*sizeof(char))); freq = (int *)(malloc(256*sizeof(int))); (i=0; i<=255;i++){ arr[i]=i; freq[i]=0; printf("%c",i); } my question why happens? due using unsigned char iterator? i <= 255 if i of type unsigned char , type 8 bit on platform (which is), expression true , have infinite loop. well-defined behavior, though. unsigned char wrap around , value start @ 0 again once has reached 255. the solution simple of course: change type of i int . to avoid such surprises in future, make sure turn on compiler's warnings. if compile bogus loop gcc , pass -wall , -wextra flags, tell me this. main.c: in function ‘main’: main.c:5:17: warning: comparison true due limited range of data type [-wtype-limits] (i = 0; <= 255; ++i)

hash - for each loop in hashes in ruby? -

i'm new in ruby i'm learning hashes , below code behaving hell please hash = {"15" => {:a=>"a_15", :b=>"b_15", :c=>"c_15 ", :d=>"pass"}, "16" => {:a=>"d_16", :b=>"e_16", :c=>"f_16 ", :d=>"fail"}} mod= {} h = {} hash.each |k,v| v.each |x,y| mod[x] = y end h[k] = mod # mod={} # don't want use technique # creates new object not required end p h expected output: {"15" => {:a=>"a_15", :b=>"b_15", :c=>"c_15 ", :d=>"pass"}, "16" => {:a=>"d_16", :b=>"e_16", :c=>"f_16 ", :d=>"fail"}} actual output : {"15"=> {:a=>"d_16", :b=>"e_16", :c=>"f_16 ", :d=>"fail"}, "16"=> {:a=>"d_16", :b

ember.js - Error while using simple login in ember? -

i newbie ember , part of learning trying set login form 1 tutorial doesnot seem working. error: invalid path---thats error getting in login method i want see if password okay connect login template else kick user '/'.? html file <script type="text/x-handlebars" data-template-name="login"> {{message}} <br> e-mail {{view ember.textfield target="controller" valuebinding= controller.email}} <br /> password {{view ember.textfield target="controller" valuebinding= controller.password}} <br /> <button {{action login}}>login</button> </script> <script type="text/x-handlebars" data-template-name="loggedin"> welcome our site ! </script> js file app.logincontroller = ember.objectcontroller.extend({ email :null, password :null, message :null, login : function() { var logincreds = this.getproperties('e

git - How do I access deployment history in Azure Web Apps? -

Image
i set multiple deployment slots web app. have continuous deployment configured on staging slot, each git commit on specific branch triggers deployment staging slot. once verified, swap staging , production slots. there way view (and redeploy if desired) deployment history slot? don't want limited reverting swap, able select specific deployment. the continuous deployment setting staging slot shows 2 deployments, though there have been many more. there way access full deployment history? when dealing slots, behavior bit complex (and might argue confusing!). trickiness comes fact deployment history moves content of site when perform swaps. i'll illustrate example: you start production slot (i.e. main app), , staging slot. no deployments have happened yet. deployment #1 happens staging slot you swap production at point, see no history in staging slot because history swapped production slot. now deploy #2 staging slot, , swap production. the history on sta