Posts

Showing posts from February, 2011

php - mysql WHERE clause not working -

i select multiple values in clause not selecting anything. this select query have: 'select * table id in (4, 5) order id desc' what missing? i imagine table has no data id = 4 or id = 5. try select * table id = 4 does return either? bet no.

swift - Join Multidimension Arrays -

i have multiple arrays of different sizes, instance: let array1 = [[1, 2, 3], [1, 2, 3]] let array2 = [[1, 2], [1, 2]] let array3 = [[1, 2], [1, 2], [1, 2]] and wanna join them final array: let finalarray = [[1, 2, 3, 1, 2, 1, 2], [1, 2, 3, 1, 2, 1, 2], [1, 2]] any ideia on how can achieve goal in efficient way? try this: var finalarray:[[int]] = [] index in 0..<max(array1.count,array2.count,array3.count) { finalarray.append([]) if index < array1.count { finalarray[index].appendcontentsof(array1[index]) } if index < array2.count { finalarray[index].appendcontentsof(array2[index]) } if index < array3.count{ finalarray[index].appendcontentsof(array3[index]) } } finalarray // [[1, 2, 3, 1, 2, 1, 2], [1, 2, 3, 1, 2, 1, 2], [1, 2]]

refactoring - Rails helper methods with conditional parameters -

sometimes in rails views, have duplicated code, because have set parameters of rails helper method according conditions. like: <% if %> <%= link_to "target", @target, class: "target-a" %> <% else %> <%= link_to "target", @target, class: "target-b" %> <% end %> or example: <% if tooltip == false %> <%= image_tag picture.url(size), class: "img-responsive #{css_class}" %> <% else %> <%= image_tag picture.url(size), class: "img-responsive #{css_class}", data: { toggle: "tooltip", placement: "bottom" }, title: "#{picture.name}" %> <% end %> is there way of writing in more elegant way (without repeating whole helper)? thanks you can isolate differences in options hash , merge differences shared base options hash: <% link_options = if {} else { data: { toggle: "tooltip", placem

Why would I use classmethod constructor in Python? -

i reading effective python slatkin. in item 24, talks achieving polymorphism in python using classmethod functions play role of constructors. however, not clear me why necessary. why can not achieve same goal using __init__ , overriding in every derived class, same way we're overriding classmethod ? in case, has 1 constructor per class, why not use regular init purpose rather classmethod? you can see what's item 24 here, unfortunately details missing: http://ptgmedia.pearsoncmg.com/images/9780134034287/samplepages/9780134034287.pdf more details here: http://qiita.com/giwa/items/fd563a93825714cffd70 in examples given in book, classmethod doesn't produce single element. different classes support same classmethod (same signature) produce instances or how many produce, delegated class. the pathinputdata class, example, produces inputs based on config['data_dir'] configuration, using os.listdir() read input files. can imagine databaseinputdat

reverse engineering - How to use Xposed framework on Android emulator -

i trying api 17 , i'm unable turn on xposed framework . exact steps were: start emulator partition size 1024 adb install xposedinstaller.apk adb remount (make system dir writeable) launch xposed installer , click on "install/update" i blank error message , says framework not installed. personally, i'd recommend genymotion instead of built-in avds. couldn't ever xposed working regular avds. http://www.genymotion.com/ once have genymotion virtual device created can drag-and-drop xposedinstaller.apk onto virtual device , it'll move , install apk automatically. then it's matter of opening installer , clicking on "install/update" , voila, done!

javascript - Mixed Content Error when sending Ajax request to Rails server on Heroku -

i working on rails app , using ajax update page part of live search feature. code works locally when push heroku see following error occurs when ajax request fired: mixed content: page @ 'https://hipster-meet.herokuapp.com/users' loaded on https, requested insecure xmlhttprequest endpoint 'http://hipster-meet.herokuapp.com/users?query=a'. request has been blocked; content must served on https i serving jquery through asset pipeline. in production.rb have included line: config.force_ssl = true this javascript sending request: ready = -> $('.search-field').keyup -> query = $('.search-field').val() $.getjson('/users', {query: query}) return $(document).ajaxsuccess (e, xhr, options, data) -> resultarea = $('.search-results') if data.length resultlist = data.map (user)-> return '<li class="result-item">' + user.username + '<hr/></li>&#

malloc - how do I allocate memory for some of the structure elements -

i want allocate memory elements of structure, pointers other small structs.how allocate , de-allocate memory in best way? ex: typedef struct _some_struct { pdatatype1 pdatatype1; pdatatype2 pdatatype2; pdatatype3 pdatatype3; ....... pdatatype12 pdatatype12; } some_struct, *psome_struct; i want allocate memory pdatatype1,3,4,6,7,9,11.can allocate memory single malloc? or best way allocate memory these elements , how free whole memory allocated? there is trick allows single malloc , has weighed against doing more standard multiple malloc approach. if [and only if], once datatypen elements of some_struct allocated, not need reallocated in way, nor any other code free on of them, can following [the assumption pdatatypen points datatypen ]: psome_struct alloc_some_struct(void) { size_t siz; void *vptr; psome_struct sptr; // note: optimizes down single assignment siz = 0; siz += sizeof(datatype1); si

sql server 2008 - SQL select into a variable, resulting in incorrect value of variable -

the problem having select seeming use old value of variable, when values don't exist. the first run of script, neither group id in table, both select statements on own should return answergroupid = null. subsequent runs of script both groups should exist , queries return valid int, used delete before re-creating. i have workaround, understand going wrong prevent errors in future. the basic structure of tables is: answer table has list of answers (one row per answer) linked via group id (int column). answergroup table has group level properties (groupid normal int column, table has separate primary key) using sql server 2008. --comments cut out irrelevant code declare @groupnametoadd varchar(100) declare @answergroupid int set @groupnametoadd = 'group1' print @groupnametoadd -- prints 'group1' select @answergroupid = a.groupid myschema.answers join myschema.answergroup ag on a.groupid = ag.groupid a.answervalue = @groupnametoadd -- ** result of abov

cordova - Ionic - How To Check Bluetooth State Change -

currently i'm using cordova.plugins.diagnostic check whether bluetooth on or off. if bluetooth off prompt asking user turn on , 'continue button' disabled. after on, how can detect on , make continue button enable. below code how detect bluetooth enable/disable: cordova.plugins.diagnostic.isbluetoothenabled(function(enabled){ console.log("bluetooth " + (enabled ? "enabled" : "disabled")); }, function(error){ console.error("the following error occurred: "+error); }); then, code how check changes made bluetooth state: $ionicplatform.ready(function() { cordova.plugins.diagnostic.registerbluetoothstatechangehandler(function(state ){ if(state === cordova.plugins.diagnostic.bluetoothstate.powered_on){ alert("bluetooth able connect"); $scope.bluetoothisenabled = true; } else if(state === cordova.plugins.diagnostic.bluetoothstate.powered_off){ alert("bluetooth off&q

php - How to perform select where in array column - Symfony3 + Doctrine -

i have created entity symfony3 set field column in database array. symfony saved db registers like: id | name | roles 01 | raphael | ["role_admin", "role_super_admin"] 02 | jose a. | ["role_admin"] 03 | marcos | ["role_user"] how can perform select doctrine role_admin or role_user ? i`ll need create search many other situations... 1 easiest explain... hope understand situation... thanks! i solved problem using syntax: $formdata = $form->getdata(); $em = $this->getdoctrine()->getmanager(); $usersrepository = $em->getrepository('appbundle:usuario'); $qb = $usersrepository->createquerybuilder('r'); $qb->select('a') ->from('appbundle:usuario', 'a'); foreach($formdata $key => $value) { foreach($value $k => $item){ $qb->andwhere("a.$key :it_$k") ->setparameter("it_$k", '%'.$item.'%'

what are the sampling methods in spark? Why not reservoir sampling? -

i know reservoir sampling can applied in parallel, spark seems use other sampling methods have no idea about. describe them briefly? according @tristan answer, guess purpose of not using reservoir sampling keep balance of classes. go though source code , found noting labels. i know existence of stratified sampling

jquery - How to post variable into controller (PHP+AJAX+MVC) -

i'm trying post variable php controller ajax: $(".inp_pr").keypress(function(f) { if (f.which == 13) { datastring = 'qwe'; $.ajax({ type: "post", url: "/prwrk/", data: 'datastring=' + datastring, success: function(data) { alert('<?php echo($data)?>'); } }); event.preventdefault(); } }); controller source: function action_index() { $data=$_post['datastring']; $this->view->generate('prwrk_view.php', 'template_view.php',$data); } ajax posts variable success, controller has no it. think, not correct url, not working full url controller file. router source: class route { static function start() { $controller_name = 'main'; $action_name = 'index'; $routes = explode('/', $_server['request_uri']); if ( !empty($routes[1]) ) { $controller_name = $routes[1]; } if ( !empty($routes[2]) ) { $action_name = $routes[2]; } $model_name = &

c++ - Remove child nodes from parent - PugiXML -

<node> <a> <b id = "it_den"></b> </a> <a> <b id = "en_ken"></b> </a> <a> <b id = "it_ben"></b> </a> </node> how can remove child node of <a></a> has child node <b></b> has attribute id not starts it using pugixml. result below: <node> <a> <b id = "it_den"></b> </a> <a> <b id = "it_ben"></b> </a> </node> this tricky if want remove nodes while iterating (to keep code single-pass). here's 1 way it: bool should_remove(pugi::xml_node node) { const char* id = node.child("b").attribute("id").value(); return strncmp(id, "it_", 3) != 0; } (pugi::xml_node child = doc.child("node").first_child(); child; ) { pugi::xml_node next = child.next_sibling(); if (shoul

jquery - bxslider with thumbnails. I need to fix the position of thumbs -

Image
i using bxslider show sliders. these sliders has thumbnails unable fix position of thumbnails, these on main image. you can view live site http://jardinesyriegosdelsur.com/portafolio.php?g=8 or can choose gallery left side. site in spanish coding in english. just update css below: .bx-wrapper .bx-pager { /* bottom: -200px; */ top: 480px; } and below:

git - How to push code to webserver every time I make a commit to a branch? -

i have lamp stack (rhel 7, apache 2.4) on aws ec2 instance , webroot directory var/www/html. php code reside in remote private github repository (note: private repo). make automatic deployment such that, everytime commit branch (not master, branch), updated php file available on webserver. how in simplest way? pls note, have verified have connectivity github aws ec2 instance , can install git client on ec2 instance. use client side post-commit hook push it. see https://git-scm.com/book/en/v2/customizing-git-git-hooks . don't forget make .git/hooks/post-commit file executable , remember hook file isn't part of repo gets pushed server.

spring - java.lang.NoSuchMethodError: org.springframework.core.io.ResourceEditor.<init>( -

i newbie springs 3.0.and started small app show firstname,lastname , other properties jsp in springs. still able show message coming controller when trying properties mentioned above, facing exception regarding load() exception of 'spring-servlet.xml' . still got suggestion check whether resourceeditor() present in springs-core jar file.but present.i have given exception trace reference. please suggest me option resolve issue. severe: standardwrapper.throwable java.lang.nosuchmethoderror: org.springframework.core.io.resourceeditor.<init>(lorg/springframework/core/io/resourceloader;lorg/springframework/core/env/propertyresolver;)v @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:123) @ javax.servlet.genericservlet.init(genericservlet.java:212) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1206) @ org.apache.catalina.core.standardwrapper.load(standardwrapper.java:1026) @ org.apache.catalina.c

python - Sorting Data and printing into a file -

i have 5 functions i) lab average ii) program_average iii) midterm_average iv) final , v) weighted_total_score how create new function sort data based on 1 of options above , write file of users choice? my code far rather repetitive. there way can condense this? def sorted_data(student_name): print("this option sorting students data , printing in file") print("(i) lab average, (ii) program average, (iii) midterm average, (iv) final, (v) weighted total score") user_sorted_data=(input("select 1 of options (i-v):")) write_sorted_file=print(input("what file written into?")) if (user_sorted_data=='i'): print("you have selected sorting student data upon lab average") f=open('write_sorted_file','w') f.write (str(student_lab_average(student_scores))) f.close() if (user_sorted_data=='ii'): print("you have selected sorting student dat

code generation - could I generate mybaits Mapper dynamically? -

<javaclientgenerator type="xmlmapper" targetpackage="com.aaa.${module}.domain.mapper" targetproject="src/main/resources"> <property name="enablesubpackages" value="true" /> </javaclientgenerator> the var ${module} value of domainobjectname in table config. <table schema="test" tablename="account" domainobjectname="account" > <property name="useactualcolumnnames" value="true"/> </table> yes, need create custom javaclientgenerator. don't think enablesubpackages property works quite way. in config file have: <javaclientgenerator type="com.mydomain.myjavamappergenerator" targetpackage="com.aaa.${module}.domain.mapper" targetproject="src/main/java"> </javaclientgenerator> and need subclass existing javamappergenerator own version. option 1 or 2 below. option 2 1 go given

machine learning - How do you add new categories and training to a pretrained Inception v3 model in TensorFlow? -

i'm trying utilize pre-trained model inception v3 (trained on 2012 imagenet data set) , expand in several missing categories. i have tensorflow built source cuda on ubuntu 14.04, , examples transfer learning on flowers working great. however, flowers example strips away final layer , removes 1,000 existing categories, means can identify 5 species of flowers, can no longer identify pandas, example. https://www.tensorflow.org/versions/r0.8/how_tos/image_retraining/index.html how can add 5 flower categories existing 1,000 categories imagenet (and add training 5 new flower categories) have 1,005 categories test image can classified as? in other words, able identify both pandas , sunflowers? i understand 1 option download entire imagenet training set , flowers example set , train scratch, given current computing power, take long time, , wouldn't allow me add, say, 100 more categories down line. one idea had set parameter fine_tune false when retraining 5 flower cate

android: visual issues on a custom slider -

Image
i created custom slider working fine, started showing visual issues , have no idea solve problem. the issue appearance of black borders/gradients around it. tested on android 6 , android 4.0.3 well. both showing same problem. on android 4.0.3, can see problem around actions in toolbar when press on them, makes black gradient shadow. any idea? the code of slider is: public class styledseekbar extends seekbar { public styledseekbar(context context) { super(context); this.init(); } public styledseekbar(context context, attributeset attrs) { super(context, attrs); this.init(); } public styledseekbar(context context, attributeset attrs, int defstyleattr) { super(context, attrs, defstyleattr); this.init(); } @targetapi(build.version_codes.lollipop) public styledseekbar(context context, attributeset attrs, int defstyleattr, int defstyleres) { super(context, attrs, defstyleattr, defstyleres); this.init(); } /** * initializes instance of class.

256 (maximally) distinct markers in Google Fusion Table Maps? -

i have 400k points in following format: latitude longitude label where label number between (0, 256). want show them on map distinct colors/markers. i mapping points using label column type text , results here . the problem: seems labels have same marker, specially ones shown red in map despite having different labels. know column should have name of marker. the question: there way can automatically map label column 256 distinct markers?

javascript - Disabling of second dropdown depending on the value of the first dropdown in JSF -

i have dropdown id "onemenu1". jquery given below onchange event not working. unable know problem. leads appreciated. $('#onemenu1').change(function() { if ($('#onemenu1').val() == 'never') { $('#secsdropdown').attr('disabled', true); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <p:selectonemenu id="onemenu1" required="true" styleclass="vehavailclass" requiredmessage="#{itrams['refreshratereq']}" editable="true" style="width:100px" value="#{dashboardaction.selectrefreshrate}"> <f:selectitem itemlabel="#{dashboardaction.vehicleavail}" itemvalue="#{dashboardaction.vehicleavail}" /> <f:selectitems value="#{dashboardaction.getrrlist()}" /> </p:selectonemenu> <!-- jira 741 start --> <p:selectonemenu id="s

php - Update in SQL not working -

first of all, let me tell beginner in php & sql. so, bear me. have table 1 row , 1 column date_latest. have edit field. following code in php:- $result = "update admin set date_latest='$dt'"; if(mysql_query($result){ echo "success"; } else {echo "oops! went wrong";} } the code not working. appreciated. isn't there problem brackets? if(mysql_query($result)){ echo "success"; } else { echo "oops! went wrong"; }

c# - Mimicking custom function -

i have defined custom functions in following script , attached gameobject. want declare function onreticleenter() mimick onpointerenter() . possible? want because want access function onreticleenter() in inspector can define multiple actions eventtrigger's point enter, exit etc. possible make function onreticleenter() behave onpointerenter() programmatically? using unityengine; using system.collections; public class myobject : monobehaviour { // custom reticle events public gameobject gobj; public void onreticleenter() { gobj.setactive(true); } public void onreticleexit() { gobj.setactive(false); } public void onreticlehover() { gobj.setactive(true); } } you need inherit interfaces pointerenter , pointerexit events in class able implement them. code might : using unityengine; using unityengine.eventsystems; using system.collections; public class myobject : monobehaviour,ipointerenterhand

postgresql - How to handle timestamp with timezone on postgres with knex.js -

i trying translate following sql query knex: select count(*) finished_on_time task_history date = 20160303 , store_id = 2 , (schedule_start_time @ time zone 'australia/sydney' + interval '1' minute * floor (group_duration) )::time >= (finish_time @ time zone 'australia/sydney')::time date field has in yyyymmdd format here have been trying on knex: db.table('task_history') .count('*') .where({date: request.params.storeid, store_id: request.params.storeid }) ?????? as can guess, not sure clause use handle sql syntax [at time zone australia/sydney ]. i have been trying find similar soloutions on internet, ended here. http://knexjs.org/#builder-whereraw db.table('task_history') .count('*') .where({date: request.params.storeid, store_id: request.params.storeid }) .whereraw("(schedule_start_time @ time zone 'australia/sydney' + interval '1' minute * floo

xcode - JSON error in swift -

i new swift , api programming , running following error: uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfnumber length] this line causing error: print(json[“totalpostsbyuser”]) for more context, more complete code sample: let jsonstr = nsstring(data: request.httpbody!, encoding: nsutf8stringencoding) let task = session.datataskwithrequest(request, completionhandler: { (data, response, error) -> void in let httpresponse = response as? nshttpurlresponse var err: nserror? if httpresponse!.statuscode == 201 { if error == nil { let jsonstr = nsstring(data: data!, encoding: nsutf8stringencoding) let jsondata: nsdata = jsonstr!.datausingencoding(nsutf8stringencoding)! { if let json: anyobject = try nsjsonserialization.jsonobjectwithdata(jsondata, options: nsjsonreadingoptions.allowfragments) { let responsestring = nsstring(data: data!, encoding: nsutf8stringencoding)

docker - Google cloud container engine vs normal vm -

short question container engine: why should use rather handle docker containers in normal vm (in compute engine)? save little money, way... regards, marc at small scale, running containers in normal vms fine. google offers container optimized image makes easy. , it's less expensive running kubernetes cluster (either in google container engine or yourself). what's powerful kubernetes / gke cluster management api. allows introspect of containers running on compute, either using cli/ui or other programs. normal vm, find out of containers running you'd either need repeatedly ssh each of vms , run docker ps or build containers "phone home" central container version authority (which won't possible if want use off-the-shelf containers). kubernetes, can kubectl pods , single command know running. can use constructs built application management deployments (or kubectl rolling-update ) push new versions of containers without restarting vms. , cluste

c# - Databind text to a string property -

i'm new silverlight , concept of data-binding , still fail on resolving problem. haven't manage find solution after few days of research. here problem : i correctly bind string property text of textblock can see below : mainpage.xaml <grid background="blue" datacontext="{staticresource wp8displayable}"> <textblock x:name="tbcanvastitle" textwrapping="wrap" text="{binding titledisplayable}" fontweight="bold" horizontalalignment="center"/> </grid> wp8displayable.cs public class wp8displayable : idisplayable, inotifypropertychanged { public string title { get; set; } #region inotifypropertychanged members public string titledisplayable { { return title; } set { if (title != value) { title = value; notifypropertychanged("title

java - How to check (replace) the MyFaces version used by Websphere 8.5 -

after upgrading websphere 8.5 i've experienced incompatibilites in jsf application. possible caused uncanonical use of jsf components, wanted check version used according document: http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2fcom.ibm.websphere.nd.doc%2fae%2frovr_specs.html websphere 8.5 uses apache myfaces 2.0.x (without specifying version). i searching myfaces*.jar withing websphere installation folder - nothing found. what version of myfaces websphere 8.5 using? how find jar withing websphere installation? optionally, possible replace it? you add own myfaces implementation , load 1 instead. therefor have change classloader , set parent_last. older versions showed installed jsf version during jsf initalization, ibm has customized jsf version anyways.

objective c - preferredInterfaceOrientationForPresentation must return a supported interface orientation in ios6 -

Image
i creating universal app .when tried running application in ipad.the application getting crashed showing above error working in ios.could guys me out.below code -(bool)shouldautorotate { if ([[uidevice currentdevice]userinterfaceidiom]==uiuserinterfaceidiompad) return yes; else return no; } -(uiinterfaceorientation)preferredinterfaceorientationforpresentation { if ([[uidevice currentdevice]userinterfaceidiom]==uiuserinterfaceidiompad) { return (uiinterfaceorientationlandscapeleft | uiinterfaceorientationlandscaperight); } return uiinterfaceorientationportrait; }

sql server - How do I remove seconds from date time in SQL query -

Image
this question has answer here: how display date mm/dd/yyyy hh:mm am/pm using sql server 2008 r2? 7 answers there several ex same type think bit unique. my query is: select convert(nvarchar(15),date,103)+ ' ' + ltrim(right(convert(char(20),date, 22), 11))dc table1 result is: i getting right in above result. thing need require format should 09/11/2015 2:29 pm . there many format achieve user unlike change other format. thank in advance try this: select convert(nvarchar, date, 101) + ' ' + left(right(convert(nvarchar, date, 100), 7),5) + ' ' +right(convert(nvarchar, date, 100), 2)

bash - Randomly create files and folders size of in 1M, 10M, 100M, 1G, 10G -

i have searched lot couldn't find solution this. insida folder, how create random files , folders size of in 1m, 10m, 100m, 1g, 10g. each created folders needs have randomly created file in it. you use dd different file sockets, e.g. /dev/random or /dev/zero . this create 2mb file random data in it: dd if=/dev/urandom of=file.out bs=1m count=2 or create 1mb file /dev/zero : dd if=/dev/zero of=file.out bs=1024 count=0 seek=1024 there lot of examples out there, search "linux dd create file size". should wrapped in script create directories , files you. think of this. #!/bin/bash #create files of 1, 10, 100 , 1000mb in size fsize in 1 10 100 1000 #create file size 1mb*fsize dd if=/dev/zero of=file.out bs=1024 count=0 seek=$((1024*fsize)) done combined script create directories , fsize loop should want.

shieldui - How to trigger an event when shield-ui grid cell text box destroyed -

Image
as mentioned in question title need trigger event shield-ui grid editable cell textbox destroyed. couldnt find solution in documentation.any appreciable. thank you. here code far ... $("#alltransgrid").shieldgrid({ datasource: { data: datad, schema: { fields: { mbr_id: {path: "mbr_id", type: string}, lon_id: {path: "lon_id", type: string}, center_name: {path: "center_name", type: string}, grp_name: {path: "grp_name", type: string}, mbr_name: {path: "mbr_name", type: string}, lon

sql - How to insert big chunk of data into db? -

i using nopcommerce , arvixe hosting. i have xml file contains products site (about 26000 records). wrote plugin allows me add records using sql script. the problem is: time of request ends , first 500 - 1000 records appears in db. recommend? maybe should move code different place (not in plugin)? try sqlbulkcopy : using (sqlconnection destinationconnection = new sqlconnection(connectionstring)) { destinationconnection.open(); using (sqlbulkcopy bulkcopy = new sqlbulkcopy(destinationconnection)) { bulkcopy.destinationtablename = "dbo.bulkcopydemomatchingcolumns"; try { // reader sqldatareader has 26000 records bulkcopy.writetoserver(reader); } catch (exception ex) { console.writeline(ex.message); } { reader.close(); } } }

Getting error when serialize xml to c# class -

i'm trying serialize xml file c# object i'm getting following error: there error in xml document (1, 64). i copy xml file , pasted special xml in visual studio. this xml: <?xml version="1.0" encoding="windows-1252" standalone="yes"?><root><record codunic="g15_455262_ro6739810_2016" codstatie="g15" docid="1" tipdoc="gastro" nrdoc="455262" datadoc="2016-01-21" dataintr="2016-01-21" nrintr="0" retur="0" dataanulare="" codfurnizor="ro6739810" denfurnizor="sc ifantis ggg srl" valoarefaratva="171.91" valoaretva="15.47" /></root> this generated "special class" : using system; using system.collections.generic; using system.linq; using system.text; namespace xmlchecktool.clase { /// <remarks/> [system.serializableattribute()] [system.componentmodel.designerc

java - Showing live camera streaming window in angularJS -

i working in angular , java project, need show camera live (camera added using ip) in web page (developed in angular). heard g streaming can me on did not found helpful link this. i wondering if g-streaming way show camera live streaming or there thing else can do. any great help. as demo have little knowledge on this, please ask if doubt. update: i need ready demo can put camera's ip , show live in webpage developed in angular. just few infos until question closed .. i found this and this i think can stream camera gstreamer rtsp server implementation , open web browser if understand properly.. hth

Xamarin.iOS: Is it possible to "override" image resources from subproject? -

i'm little bit confused when using images same name in main ios project , subproject (library) i create ios project (main) bundle resource image 'a.png' i create second project (subproject) bundle resource image 'a.png' (same name different image) i change second project type library , add first project reference. when build app , check result app bundle (and use image in app), see 'a.png' image subproject library expected see image included in main project. correct behaviour? there way how "override" image subproject? i planned subproject library "base collection" of images , use in several other projects of images replaced. thank you have @ forms9patch , more here it allow need pay add-on. might bit more research find free options.

javascript - Get index of current object in array? Pass current object to a function. Angular JS -

i trying call function object in array. (the objects of array placed on map.) function should evaluate 'status' object has, , return url icon based on status. have pass current object function.. how do it? my array of objects: mvc.models = [{ id: "1", icon: evaluatecolor(currentobject), status: 'green' }, { id: "2", icon: evaluatecolor(currentobject), status: 'red' }]; my function: function evaluatecolor(currentobject) { if (currentobject.status === 'green') { return 'images/green_marker.png' } else if (currentobject.status === 'yellow') { return 'images/yellow_marker.png' } else { return 'images/red_marker.png' } } i have tried pass object function passing 'this', object logs undefined. because 'this' refers controller , not object. mvc.models = [{ id: "1", icon: evaluatecolor(this), status: 'green' }, { id: &

Using INSTR (oracle function) in Simple.Data -

how use instr simple.data i need add condition while joining 2 tables select * table inner join table b on instr(a.column , b.column)>0 how write query using simple.data (c#)? i can't test right if work, try: db.a.findall().join(db.b).on(db.a.column.instr(db.b.column) > 0);

Sitecore 7 Faceted search (front-end), no SOLR -

i not able find information, if faceted search works in sitecore 7 no internal search, front-end side. can business user specify facets, can used site visitor on front-end, using sitecore built-in search , not using solr engine? did looked @ developers guide item buckets , search ? can create facets can used internal search , front-end search also. 5.6.9 creating new search facet you can use facets drill down more specific results in list of search results. default facets displayed in facets menu on right side of search results. create custom facet, navigate /sitecore/system/settings/buckets/facets item of content tree. right click on facets item , in context menu, click insert, facet. have specify name of field in index, in parameters field in content tab. can apply hierarchical faceting listing many fields separated commas. useful if want facet on, example, clothes type first, , on color... you can filter facets in linq, eg: var results = queryable.

Java: why should static interface methods have a body? -

i need have bunch of classes initialize static method instead of static {...} block initialization tasks run. in java 8 possible define static interface method don't need have body, need know class implements static method. interface initializable { static void initialize(){} } class icons implements initializable { public static void initialize(){ //... } //... } what's wrong idea of using static interface methods in case , why not possible define interface static method without body? general purpose is: initialize collection of classes on application start calling respective methods. initialization tasks are: establishing database connection, rendering icons , graphics, analyzing workstation configuration etc. what want not possible. interfaces prescribe instance methods need implemented class. a static method not need instance of containing class run, , thus, if not need private members, can in principle placed anywhere. si

java - VerticaCopyStream is very slow -

i use vertica flex table load json vertica without defining tables, , got problems loading time. i connect vertica jdbc drive , use code.. string copyquery = "copy schema.tablename stdin parser fjsonparser()"; verticacopystream vstream = new verticacopystream((verticaconnection)conn, copyquery); inputstream input; vstream.start(); for(jsonnode json : jsonlist){ input = new bytearrayinputstream(json.tostring().getbytes()); vstream.addstream(input); input.close(); } vstream.execute(); vstream.finish(); the command "vstream.execute()" takes 12 seconds 5000 jsons when use copy command file runs less second. your problem not verticacopystream , problem regard different parsers used , need compare apple apple , json parser should more slower simple csv parser .

node.js - Return number of files at ZIP package with NodeJS -

here function number of files within zip package. // check if .zip package contains @ least 1 html file , return number of files function validatearchive(path, callback) { var filescount = 0; var unzipparser = unzip.parse(); var readstream = fs.createreadstream(path).pipe(unzipparser); unzipparser.on('error', function(err) { throw err; }); readstream.on('entry', function (entry) { var filename = entry.path; var type = entry.type; // 'directory' or 'file' if (type == 'file') { var fext = filename.split('.')[1]; if (fext === 'html') { filescount++; } } entry.autodrain(); }); // returns number of files settimeout(function () { callback(filescount); }, 1000); } as can see have problem returning number of files because asynchronous process in place. any ideas hot return number

c++ - How to befriend QEventLoop and winapi event loop -

i have myapp class winapi event loop in it class myapp : public qobject { q_object public: int winapi exec() { msg msg; int nretval; while ((nretval = ::getmessage(&msg, nullptr, 0, 0)) != 0 && nretval != -1) { ::translatemessage(&msg); ::dispatchmessage(&msg); } return msg.wparam; } }; when start program, qobject 's events won't process (can't invoke slot , hence send signals). somewhere on internet found kind of solution - create qapplication object, somehow "hooks up" winapi message loop , worked: int main(int _argc, char* _argv[]) { qapplication qa(_argc,_argv); unreferenced_parameter(qa); myapp mapp(); return mapp.exec(); } but seems me design fragile , hack. , don't i'm using undocumented feature , never call qapplication.exec() method. can tell me how right way? namely, want call 1 exec method (i guess 1 of qapplication ,

How to run long cron jobs on App Engine flexible environment? -

i have app on app engine (flexible environment) , configured few cron jobs. these jobs should take several minutes see them failing after ~30 seconds (502 error). documentation not clear regarding max time of cron jobs ( scheduling jobs cron.yaml ), although seems "an http request invoked cron can run 24 hours". any ideas of how overcome this? in advance this answer own question. the problem had had 1 gunicorn worker. app engine health checks happening every 30 seconds , there no worker able reply health checks, server restarted. i should have added more workers in app.yaml file. example, i've added following line. entrypoint: gunicorn -b :$port main:app --workers 12 hope helps.

Matlab MCR expired -

i have matlab compiler runtime installed on machine. working fine, when run code needs error: failed initialize mcr instance: specified component has expired. i thought mcr free download i'm wondering if had trial version or something, though far can see there's nothing says case on matlab download site. anybody else had same problem? yes, executable can expire, not mcr. colleague of yours had trial license of matlab compiler , compiled executable. went onto distribute executable you. executable work 1 month. past that, executable expires.

multithreading - Array getting destroyed when thread exits in perl -

i trying use threading parsing 2 different types of files. subroutines share no data @ all. # parse header files $hdr_thrd = threads -> create(\&parser::parse_header_file, $path); # parse input template files $tmplt_thrd = threads -> create(\&templateparser::parse_template); # join threads $tmplt_thrd -> join(); $hdr_thrd -> join(); # uses data obtained above 2 threads &parser::parse_xml_template(); the problem comes when parse_xml_template function tries access array @templateparser::array . array has no data @ point getting filled inside parse_template function. missing something? you're trying share data across threads without sharing it. need use :shared or share() on variable. you wouldn't have problem @ if avoid global vars should. sub parse_template { @tmplt_result; ... return \@tmplt_result; } $hdr_thrd = threads->create(\&parser::parse_header_file, $path); $tmplt_thrd = threads->create(\&

c# - Visual Studio 2015 designer crash -

i have method: static public void writeerrortofile(string errormassege, string helplink) { string text = datetime.now.tostring() + ":" + environment.newline + errormassege + environment.newline; if (!string.isnullorwhitespace(helplink)) { text += "help link: " + helplink + environment.newline; } text += environment.newline; file.appendalltext("errors.txt", text); } i call method every time expception occurred, designer in visual studio 2015 crashes massege: unauthorizedaccessexception: access path 'c:\program files (x86)\microsoft visual studio 14.0\common7\ide\errors.txt' denied. if mean call function in myviewmodel datacontext of page. if delete errors.txt file normal again. knows why happen , soulution? the problem wpf designer has execute code see data available on viewmodel designerproperties contains method getisindesignmode can use disable logic when code being executed designer

broadcastreceiver - How to access duration of audio file in android using Broadcast Receiver -

if.addaction("com.android.music.metachanged"); if.addaction("com.htc.music.metachanged"); if.addaction("fm.last.android.metachanged"); if.addaction("com.sec.android.app.music.metachanged"); if.addaction("com.nullsoft.winamp.metachanged"); if.addaction("com.amazon.mp3.metachanged"); if.addaction("com.miui.player.metachanged"); if.addaction("com.real.imp.metachanged"); if.addaction("com.sonyericsson.music.metachanged"); if.addaction("com.rdio.android.metachanged"); if.addaction("com.samsung.sec.android.musicplayer.metachanged"); if.addaction("com.andrew.apollo.metachanged"); registerreceiver(mreceiver, if); } private broadcastreceiver mreceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { string action = intent.getaction(); string

sql server - Select only maximum value record for multiple rows -

i have 1 table, having records like, unit rate dateeffected ------------------------------------------- alha ils 2014-03-02 00:00:00.000 alha ils 2014-08-02 00:00:00.000 buck ils 2013-02-14 00:00:00.000 buck ils 2014-03-02 00:00:00.000 buck ils 2014-08-02 00:00:00.000 casc ild 2013-02-14 00:00:00.000 casc ild 2014-03-02 00:00:00.000 casc ild 2014-08-02 00:00:00.000 now, want maximum date value record selection in result table. is, unit rate dateeffected ------------------------------------------- alha ils 2014-08-02 00:00:00.000 buck ils 2014-08-02 00:00:00.000 casc ild 2014-08-02 00:00:00.000 hope helps. select unit, rate, max(dateeffected) maxdateeffected tablename group unit,rate

Excel vba Union method duplicates cells that overlap -

i expected following macro display 6 displays 8. understand because union duplicates cells overlap cells b1:b2 in example: sub a() dim myrange range set myrange = application.union(range("a1:b2"), range("b1:b4")) msgbox myrange.count end sub i found solution problem i'm interested know why way union works , if there other way around besides writing new function suggested above link. yes, union operator more union statement in sql. excel's union operator not return distinct set of cells.

android - Image upload with MultipartEntityBuilder -

i have following class, don't know, how resolve contenttype . why cannot used writeto() method created entity? cannot write byteoutputstream . public class imageuploadrequest<t> extends request<t> { private static final string file_part_name = "file"; private multipartentitybuilder mbuilder = multipartentitybuilder.create(); private final response.listener<t> mlistener; private final file mimagetoupload; protected map<string, string> headers; public imageuploadrequest(string uploadurl, response.errorlistener errorlistener, response.listener<t> listener, file imagefiletoupload){ super(method.post, uploadurl, errorlistener); mlistener = listener; mimagetoupload = imagefiletoupload; //call helper method build multipart entity buildmultipartentity(); } @override public map<string, string> getheaders() throws authfailureerror { map<string, stri

android - Listen for touch events in background -

is there legal way in android listen touch events user makes, outside app. mean have service listens screen gestures in background. the idea define dummy ui fragment tiny (say, 1x1 pixel), , place on 1 of corners of screen, , let listen on touch events outside it. well, literally, it's not "invisible", in fact it's in foreground time! since it's tiny users won't feel difference. first, let's create dummy view: mwindowmanager = (windowmanager) mcontext.getsystemservice(context.window_service); mdummyview = new linearlayout(mcontext); layoutparams params = new layoutparams(1, layoutparams.match_parent); mdummyview.setlayoutparams(params); mdummyview.setontouchlistener(this); here set width of dummy view 1 pixel, , height parent height. , set touch event listen of dummy view, we'll implement later. then let's add dummy view. layoutparams params = new layoutparams( 1, /* width */ 1, /* height */ layoutparams.type_pho

Missing data for column while trying to copy a csv file in a postgresql database -

i have issue trying copy csv file in table. here sql statement: drop table if exists nom_graph; create table nom_graph ( date varchar(50), edp_rec float, edp_ec float, nb_ko float ); \copy nom_graph '/home/giutools/edp/out/synthese_resync.csv' (delimiter('|')) ; and error get: psql:nom_graph.sql:179: error: missing data column "edp_rec" context: copy nom_graph, line 1: "date;edp_rec;edp_ec;nb_ko" the csv file composed : date ; , other values float. i can't understand what's issue, been trying solve 2 days now. the problem csv file, step1: convert excel file csv using http://www.zamzar.com . step2: create table in postgresql same column see in excel file. step3: copy csv file created table using below command, copy table_name (column1,column2,..) 'c:\users\public\lifile_name.csv' delimiter ',' csv header; done, hope find helpful!