Posts

Showing posts from June, 2010

amazon web services - Record live streaming video with WebRTC and stream with AWS -

i'm trying develop website lets user visit page, , lets click button, , use built in camera live stream videos audio others visit url. i need clarity on need develop, can 3rd party save time. aws looks cover encoding , delivery http://aws.amazon.com/cloudfront/streaming/ , i'm confused on process on should record , delivery content s3. information overload. in research looks should build webrtc, have done, transport data javascript clients browser server, , aws. best format, or should been using 3rd party thats putting more time element? i have seen kurento project, recordrtc project. like said, i'm finding there information overload on topic. so options for: in browser recording webrtc. else should or force users roll supporting browser? webrtc means have javascript delivery, node better option server take delivery of streaming data? anything else need know before pass off s3 delivery cloud front? as can see core of question comes within recording , ...

MS CRM 2013 Notes becoming readonly after removing title and Text -

is there workaround prevent notes in ms crm 2013 becoming readonly when remove title , text it? i editable after title , text removed notes. possible? appreciated ... you can dig record , edit it, not in parent form: advanced find > search "notes" filter regarding record (i.e. if note attached case, pick regarding(incident) ) you'll see in results empty record: open , edit it.

javascript - Jquery function to split option list into hierarchical select -

i have list looks this: <select> <option value="all" selected="selected">- -</option> <option value="16">africa</option> <option value="17">asia</option> <option value="56">-china</option> <option value="57">-japan</option> <option value="19">canada</option> <option value="20">-alberta</option> <option value="21">-british columbia</option> <option value="22">-manitoba</option> <option value="23">-new brunswick</option> <option value="24">-newfoundland &amp; labrador</option> <option value="25">-northwest territories</option> <option value="26">-nova scotia</option> <option value="27">-nunavut</option> ...

ocr - Tesseract with limited words -

is possible recognize limited set of words in tesseract? i need recognize set of words (around 200) , want tesseract correct words closest matching ones. in order that, i've updated language models words (eng.word-dawg , eng.freq-dawg) , increased sensitivity setting language_model_penalty_non_freq_dict_word , language_model_penalty_non_dict_word large numbers (tried 0.9 , 1.0). however, not have affect on output. i have word (benzoate) tesseract recognize uenzoate. weird have benzoate in dictionary.

scala - Specify default value for collections -

in scala, there idiomatic way specify default value collections when it's empty? for option s, use .getorelse . i'm thinking below: seq().ifempty(seq("aa", "bb")) // seq("aa", "bb") seq("some", "value").ifempty(seq("aa", "bb")) // seq("some", "value") the cleanest way scala (without scalaz) seems be: option(list).filter(_.nonempty).getorelse(list(1,2,3))

oracle11g - SQL query to find How many employees joined in one week -

i tried following select count(emp_id),emp_jn_dt employee emp_jn_dt between '01-nov-2014' , '07-nov-2014' group emp_jn_dt) order emp_jn_dt ; but sir asked if enter data dynamically? i have no clue on this. plz me out thank you. it doesn't matter data enter dynamically emp_in_dt must system.datetime.now if u want select last week records u should pass 2 dates 1st date should system.datetime.now , 2) datetime d=system.datetime.now.adddays(-7) i.e d try , if find difficulty or need more clarification please let me know

c# - Passing List of objects by appending it in jquery formdata -

i came across scenario in mvc 4 need send image along list of objects in ajax call. how can append in formdata? here formdata , ajax call var formdata = new formdata(); var imgfile = document.getelementbyid('profilepic'); var imgfilelist = imgfile.files; formdata.append(imgfilelist[0].name, imgfilelist[0]); // below code not workin formdata.append('rent', $scope.renttypes); // $scope.renttype = [{ id:1,price:5},{id:2,price:6}] $.ajax({ url: url data: formdata, processdata: false, contenttype: false, type: 'post' }); in controller, action called ajax call this public actionresult upload(list<rent> rent) { } rent.cs public class rent { public int id; public int price; public available; } in order post collection, need construct data indexers can bound defaultmodelbinder .... formdata.append('[0].id', 1); formdata.app...

amazon web services - Log in to AWS using Access Key ID and Secret Access Key ID -

in aws, how use access key id , secret access key? i can't use them in iam users sign-in link. access key id , secret access key api/cli/sdk access. iam sign-in (dashboard) need username , password. when new iam user added, user gets username, password, access key , secret key, , iam url iam admin.

c - Valgrind-Uninitialised value error with getline() function -

i want read multiple lines text file loop, conditional jump or move depends on uninitialised value(s) error in getline() line. my code: char *string; size_t len = 0; while (getline(&string, &len, filestream) != -1) { // error happens line // } free(string); fclose(filesream); i tried failed fix it. solutions appreciated. you need either of below. set char *string = null; , len 0 . [[ preferred method ]] allocate memory char *string , send size of allocated memory using len . related quotes man page referrence if *lineptr set null , *n set 0 before call, getline() allocate buffer storing line. buffer should freed user program if getline() failed. alternatively, before calling getline(), *lineptr can contain pointer malloc(3)-allocated buffer *n bytes in size. if buffer not large enough hold line, getline() resizes realloc(3), updating *lineptr , *n necessary.

Chrome App(sandboxed) with AngularJS -

i have chrome app angularjs in have sandboxed html files resolve csp error. when try add html file in main file using <ng-include src="'new.html'"></ng-include> , generates error: xmlhttprequest cannot load chrome-extension://menecddfopgklpoafdcifghpahpahlcb/new.html. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. how can add ng-include in sandboxed chrome app?? my manifest.json file: { "name": "test", "description": "test app", "version": "0.1", "manifest_version": 2, "permissions": ["storage", "webview", "<all_urls>", { "filesystem": ["write"] }], "app": { "background": { "scripts": ["background.js"] } }, "icons": { "16": "paxc...

javascript - Get values of all checked radio buttons using JQuery -

using jquery trying perform validation , values of dynamically generated radio buttons in page. i have 10 questions on page , each question has radio button group(yes/no). when click in radio button want send it's value database question, code <p>question 1</p> <input id="1_1" type="radio" name="1" value="yes" /> <input id="1_2" type="radio" name="1" value="no" /> i searched in google , found code $('input[name=radioname]:checked', '#myform').val() but don't know right way use ? as per html structure try :- var arr = []; // take array store values $('input[type="radio"][name="1"]:checked').each(function(){ arr.push($(this).val()); //push values in array });

plone - DocTest fails when creating an object -

i'm having problem doctest because i'm trying rename ids of content type object in iobjectaddedevent handler. requirement have ids sequential , context specific eg cam-001, cam-002, blk-001, blk-002, etc when add object manually in browser event handler renames id correctly when try create in doctest fails after added it's container. plone.dexterity addcontenttocontainer calls _setobject original id, event handler kicks in , renames id, , when _getobject uses original id can't find object bomb attribute error. i created product illustrate here https://github.com/mikejmets/wt.testrig . i tried using plone.api in doctest fails. all ideas welcome. since using dexterity, best solution write own namegenerator behavior. i guess dx content has following behavior activated: <element value="plone.app.content.interfaces.inamefromtitle" /> this bahavior responsible rename item after creation. should remove , add own. example: registe...

c# - Change DataGridTemplateColumn content style -

Image
i want change datagridtemplatecolumn content style, here datagridtemplatecolumn code: <datagridtemplatecolumn maxwidth="50" minwidth="30" cellstyle="{staticresource cellstyle}"> <datagridtemplatecolumn.celltemplate> <datatemplate> <label style="{staticresource fontawesome}" padding="0" verticalalignment="center" horizontalalignment="center" cursor="hand" mouseleftbuttondown="lbledit_mouseleftbuttondown">  </label> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> here cellstype code: <style x:key="cellstyle" targettype="datagridcell"> <setter property="borderthickness" value="0 0 1 0"/> <setter property="borderbrush" value="#f6f6f6"/> <setter property="foreground" value=...

jquery - tooltip for each item in dynamically generated @html.dropdownfor control in mvc3 -

i'm working on web project in mvc 3 razor c#. i have used @html.dropdownlistfor display item dynamically. want set tooltip every item of @html.dropdownlistfor . my line of code below @html.dropdownlistfor(m => m.type, new selectlist(model.types, "value", "text", model.type), new { @class = "type"}) i felt curious question tried achieve it. created simple example , made work display different tooltip on each select item hover. note: not expert in js side , not sure if ideal way. here example code: mycontroller.cs public actionresult loadcountries() { list<selectlistitem> li = new list<selectlistitem>(); li.add(new selectlistitem { text = "select", value = "0" }); li.add(new selectlistitem { text = "india", value = "1" }); li.add(new selectlistitem { text = "srilanka", value = "2" }); li.add(new select...

javascript - Saving data into JSON format through Post method -

i using angularjs . want post data in file in json format localhost server i.e. http://localhost:8080/out.json . how should post method should implement scenario ? or other working example post method able save data in json format helpful. thanks. here code : var app = angular.module('myapp', []); app.config(['$httpprovider', function($httpprovider) { $httpprovider.defaults.usexdomain = true; delete $httpprovider.defaults.headers.common['x-requested-with']; } ]); app.controller('formctrl', function ($scope, $http) { $scope.data = { firstname: "default" }; $scope.submitform=function($scope, $http) { $http.post('someurl', json.stringify(data)). success(function(data) { console.log(data); }). error(function(data) { console.log(data); }); }; }); <html ng-app="myapp"> <head> <script src="https:/...

php - Plain text in Apache rewriteCond testStr -

i have following set of apache rewritecond/rewriterule: rewritecond $1.php -f rewriterule ^(.+)/$ index.php?id=$1 what want check whether keyword in url actual file, , keyword name of file, without .php extension. example, if url www.example.com/foo/ , file foo.php exists, redirect www.example/index.php?id=foo. documentation on rewritecond says: teststring string can contain following expanded constructs in addition plain text: ...and lists constructs. so, using reference "$1" , add plain text ".php" see if pattern matches actual php file. doesn't work. examples found use "expanded constructs", none use plain text in test stiring. can used @ all? how? you need provide full path check existence of file using -f . replace rule this: rewritecond %{request_filename} !-d rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^(.+?)/?$ /$1.php [l]

php - Pages in subdirectory redirect only to that subdirectory -

i have site in 2 directories, default on root , other root/en . there way tell in .htaccess every link click on root/en version redirects root/en ? for example have link on default installation leads root/news . if user located on root/en , clicks link redirects him root/en/news . we have /en prefix before our original links. or have go , change links manually? rewrite won't work or extemely complex because have same files in both directories. apache won't know how tell link clicked unless change links. quick way change base url links in pages use <base> tag. note change base url relative resources such css, javascript , images too. if links in pages relative (i.e. don't have http://www.example.com part), can use <base> tag set base url resources on page. see: http://www.w3schools.com/tags/tag_base.asp all of pages in /en/ directory should have <base> tag sets base url, , links should start / . example: <html...

xaml - PasswordBox Hint Text in WPF -

i wrote passwordbox style.i want hint text in passwordbox when lost focus ,the hint text appering.where i'm doing mistake, how can solve problem? here code: <style targettype="{x:type passwordbox}" xmlns:sys="clr-namespace:system;assembly=mscorlib"> <style.resources> <visualbrush x:key="bg1" alignmentx="center" alignmenty="center" stretch="none" > <visualbrush.visual> <label content="enter password" foreground="lightgray" margin="5,0,0,0"/> </visualbrush.visual> </visualbrush> <visualbrush x:key="bg2" alignmentx="center" alignmenty="center" stretch="none" > <visualbrush.visual> <label content="" foreground="lightgray" margin="5,0,0,0"/> </visual...

How to get Mapreduce output in a single file instead of multiple files in Hadoop Cluster on Google Cloud? -

when running jar on local hadoop multi-node cluster, can see output reducer output , single file every job. when run same jar on google cloud, multiple output files (part-r-0000*). instead need output written single file. how do that? well 1 simple solution configure job run 1 reducer. seems on google cloud default setting different. see here how that: setting number of reducers in mapreduce job in oozie workflow another way deal have concatenating script run @ end of map reduce job pieces part-r files, ie cat *part-r* >>alloutput may bit more complex if have headers , need copy local first.

mysql - Return null rows for non-matched values in IN clause in SQL -

i have query returns records if found values in in clause. matched records vary 0 1 , result of query. want make count 5, if rest rows filled null. there way can achieve this? as, given query select categoryid, categoryname category categoryid in ( 52, 58, 60 , 62 , 64) i have values first 3 ids , result gives me 3 rows only. want count of result 5 , rest non-satisfying rows filled null values make count. current result: categoryid categoryname 52 abc 58 xyz 60 def the required result categoryid categoryname 52 abc 58 xyz 60 def null null null null use left join synthesized table lists category ids want: select c.categoryid, c.categoryname (select 52 categoryid union select 58 union select 60 union select 62 union select 64) left join category c on a.categoryid = c.categoryid another way create table contains possible category ids. use: select c.categoryid, c.categoryname ...

php - Header in the top -

at time need 2 view pages in 1 page. in session this: <?php session_start(); if(isset($_session['login_id']) && !empty($_session['login_id'])){ ?> ///my html code/// <? } else { ?> //diffetent view here// <? } require_once('../libraries/config/configpdo.php'); ?> but need make become 1 page , redirect if not logged in. <?php session_start(); if(isset($_session['login_id']) && !empty($_session['login_id'])){ ?> ///my html code/// <? } else {header("location: login.php"); ?> <? } require_once('../libraries/config/configpdo.php'); ?> but see, put header redirect @ bottom of page. how make simpl...

use local image to display in webview for windows phone 8.1 -

i have created hybrid app in windows phone 8.1 one of pages uses webview control. it has img element on it. i have small image part of build of application. 'copy output directory' set 'copy always' i have followed instructions page: enter link description here none of samples work. if assign image in c# code alternative use? i need know how absolute path of image in solutions , id webview? i guessing here. can done? additional: my html on aspx page on server <img src="/images/eyeon.png" /> i added eyeon.png image c# solution. for following this. worked me: src = "ms-appx-web:///images/nofeed.jpg" hope helps people

asp.net - Data from input box not inserting in to database -

i made form insert information in database. don't know error coming from. it's not inserting information input fields database. here's code: protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click dim id, name, description, code, cat_industry, cat_theme, cat_occasion, cat_budget string id = product_id.text name = product_name.text description = product_description.text code = item_code.text cat_industry = industry.selectedvalue cat_theme = theme.selectedvalue cat_occasion = occasion.selectedvalue cat_budget = budget.selectedvalue try dim str1 string = "insert product (id, product_name, product_description, item_code, industry, theme, occasion, budget) values ('" + id + "', '" + name + "', '" + description + "', '" + code + "', '" + cat_industry + ...

javascript - PhantomJS - Handling Network Error -

when run phantomjs script in debug mode, see error : [debug] network - resource request error: 5 ( "operation canceled" ). when run script 1000 times, i've error 1 or 2 times. want catch without running script in debug mode don't know how ! i try several error handlers : phantom.onerror = function(msg, trace) { console.log("phantomjs onerror\n"); }; page.onerror = function(msg, trace) { console.log("phantomjs onerror\n"); }; page.onresourceerror = function(resourceerror) { console.log("phantomjs onresourceerror\n"); }; page.onresourcetimeout = function(req) { console.error('phantomjs onresourcetimeout\n'); }; page.onloadfinished = function(status) { if (status != 'success') { console.error('phantomjs onloadfinished error\n'); } }; do have idea me ? how can catch error ? use phantomjs 1.9.7 x64 on unix. thanks, this question may old had same trouble today , found workaround...

javascript - $scope how to use variable in angular js -

i using angular js. below angular code $scope.remove = function (index) { var name = $scope.data.filters[index].filtername; // value of name = 'aaaa' or 'bbbb' , on $scope. data. filters. splice (index, 1); $scope.json = angular.tojson($scope.data); }; and html <div><small>{{aaaa}}</small></div> <div><small>{{bbbb}}</small></div> <select class="bbbb"> <option> .... </select> <select class="aaaa"> <option> .... </select> based on value of name want reset {{ }} vale in view. say example example reset value of {{aaaa}} if name = aaaa so how can use variable name below updated var name = $scope.data.filters[index].filtername; $scope.name = "" /// how can $(name).selectpicker('deselectall'); can me thanks, you should use bracket notation this. using can ta...

javascript - How to create and Open a dialogue Box Dynamically on page load -

this question has answer here: how open dialogue box on page load 3 answers i trying create , open dialogue box dynamically , automatically on page load in jquery mobile page not able ..i think missing thing not able .. here jquery code , function called on pageload.. function onload() { opendialogbox1(); document.addeventlistener("deviceready", ondeviceready, false); $("#searchby_chooser_ok_button").bind ("click", searchbycriteria); if (typeof contact === "undefined") { getelement("contacts_list").innerhtml = "<p>the cordova contacts api inaccessible</p>"; } } function opendialogbox1(){ $("#simplestring").simpledialog({ 'mode' : 'string', 'prompt' : 'please enter mobile no.', 'buttons' : { 'ok': { click: function () { ...

c# - An object reference is required for the non-static field, method, or property 'TingTong.MainWindow.animategrid(string, string, string)' -

i have 2 classes shown below animateutils class: namespace tingtong.view { public class animateutils { public static void animategrid(string motion, ref doubleanimation slide, ref grid grid, ref grid grid2, ref storyboard sbfade, ref storyboard sbslide) { if (motion == "away") { slide.to = 310; slide.from = 0; } else { slide.to = 0; slide.from = 310; } switch (grid.name) { case "gd_lockscreen": slide.duration = new duration(timespan.frommilliseconds(400.0)); storyboard.settarget(slide, grid); storyboard.settargetproperty(slide, new propertypath("rendertransform.(translatetransform.x)")); sbfade.children.add(slide); sbfade.begin(); ...

java - SQLSyntaxErrorException when i select a sequence from DB (ORACLE 11g) -

i have strange exception when try select sequence number database. if run query: select mysequence.nextval dual directly in db it's work fine , give me next value. when run same query on java have sqlsyntaxerrorexception . statement = connection.preparestatement(my_seq); resultset = statement.executequery(); my_seq= private static final string my_seq="select mysequence.nextval dual"; i try execute query select id anytable try if goes wrong in configuration run , return result. any idea of exception? grant select problem. grant select on db.mysequence my_user; , have done grant select commit seem's doesn't go ok. , sqlsyntaxerrorexception because have create synonym sequence, without synonym have db.mysequence . order create sequence , use in java is: create sequence create synonym use sequence make grant select sequence user have in jdbc configuration

angularjs - Migrating from $http to Restangular, tests failing -

i have following controller: 'use strict'; angular.module('app') .controller('loginctrl', function ($scope, $state, login, localstorageservice, message, authservice) { $scope.submit = function() { if (this.username) { var credentials = { username: this.username, password: this.password }; login.post(credentials).then(function(data) { if (data.status === 200) { authservice.loadcustomer(data.data); $state.go(authservice.nextpath() || 'curator'); } }, function(data) { if (data.status === 401) { $scope.password = ''; message.error('wrong e-mail/password combination'); } else { message.error('an error occured while logging in.'); } }); } } }); which migrated using $http restangular service: !(function(win...

extjs5 - Extjs 5 Uncaught TypeError: Cannot read property 'schema' of null -

i changed extjs 4.2.3 5.0.1 , have error.any ideas? uncaught typeerror: cannot read property 'schema' of null ext.define.extractdataext-all-debug.js:8144 ext.base.base.addmembers.callparentext-all-debug.js:61852 ext.define.extractdataext-all-debug.js:68174 ext.define.onnodeinsertext-all-debug.js:68093 ext.define.onnodeappendext-all-debug.js:68329 ext.define.updateroot

c# - Difference in debug/release build Xamarin.Android project -

if compile project , deploy in debug mode, works fine. app fires , can used.if same release build, app gets deployed on device, fires runs exception before self written code has executed. stack trace have showing little information. see first exception occurs after loading system.runtime.serialization.dll loaded assembly: minbuza.conference.android.dll loaded assembly: exiflib.dll loaded assembly: formsviewgroup.dll loaded assembly: microsoft.practices.servicelocation.dll loaded assembly: microsoft.practices.unity.dll loaded assembly: microsoft.windowsazure.mobile.dll loaded assembly: microsoft.windowsazure.mobile.ext.dll loaded assembly: minbuza.conference.forms.dll loaded assembly: minbuza.conference.framework.dll loaded assembly: minbuza.conference.security.dll loaded assembly: newtonsoft.json.dll loaded assembly: sqlite.net.dll loaded assembly: sqlite.net.platform.xamarinandroid.dll loaded assembly: system.net.http.extensions.dll loaded assembly: system.net.http.primitives.dl...

c# - Console app with MVC, Ninject and WCF Service (Dispose issue?) -

i have mvc application ninject stuff wired properly. within application wanted add functionality call wcf service, sends bulk messages (i.e. bulk printing) rabbitmq queue . a 'processor' app subscribes messages in queue , process them. want update stuff in database, want services , repositories mvc app available too. the processor app implements following: public abstract class kernelimplementation { private ikernel _kernel; public ikernel kernel { { if (_kernel != null) return _kernel; else { _kernel = new standardkernel(new repositorymodule(), new domainmodule(), new servicemodule(), new messagemodule()); return _kernel; } } } } all ninject repository bindings specified within reposito...

javascript - Stream a command's response up to node -

i'm trying make node package executes permanent script keeps printing data , passes package caller. i use exec object, in order call command: var exec = require('child_process').exec; // ... exec("script always", function(error, stdout, stderr) { if (error instanceof error) { throw error; } // here's gets messy if(callback) callback(stream) }); this command keeps printing data until stop it. now, how stream console output node event wants implement? i've been reading readable stream , don't know how tie (actually, heh, have function getreadablestreamsomehow() sake of examples). you should use spawn , not exec , described here . return object have direct access program's streams, can pipe them, e.g., or subscribe data events. see this example sample on how capture output of curl command. hope helps :-)

distinct count is greater than doc_count in elasticsearch aggs -

i wrote aggs query total(sum) , unique count. result little confused. unique value greater doc_count. possible? i know cardinality aggs experimentall , can approximate count of distinct values. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html but is's bad result. can see there many buckets unique larger doc_count. problem request format? or cardinality limits? half million documents indexed , there 15 type of eventid es 1.4 using. request { "size": 0, "_source": false, "aggs": { "eventids": { "terms": { "field": "_eventid_", "size": 0 }, "aggs": { "unique": { "cardinality": { "field": "uuid" } } } } } response ...

Python : filter list items from list of dictionary -

names = ['vapp1', 'vapp3', 'vapp4', 'vapp2'] vapps = [{'name':'vapp2', 'ip': '11.21.18.24', 'obj': 'obj523'}, {'name':'vapp3', 'ip': '11.21.18.27', 'obj': 'obj234'}, {'name':'vapp5', 'ip': '11.21.18.25', 'obj': 'obj246'}] result = [vapp vapp in vapps if vapp['name'] in names] print result using list/dict comprehension getting want in result. want print vapp1 & vapp4 not there in vapps . what efficient way ? or how avoid looping achieve of filtered list of dictionary names common in list names . , can print names not there. you could abuse short-circuiting of and so: >>> result = [vapp vapp in vapps if ... vapp['name'] in names , ... (names.remove(vapp['name']) or 1)] >>> names # contains names not found in vapps ['va...

javascript - Remove a div with it's child elements in jquery -

i have method need remove current div it's element on clink. it's not doing anything. have searched goggle , applied various thing no result. can please me on please?!!! here code below :: my div elements , remove link stated >>> <div class="col-xs-4 pnorppl" id="ppeople"> <div class="form-group"> <label for="participatedpeoplename"><g:message code="sl" default="সদস্যের নাম" /></label> <g:textfield id="participatedpeoplename" name="participatedpeoplename" class="form-control"/> <a onclick="addanothernormalpeople()">add more</a> || <a onclick="removethismember()">remove</a> </div> </div> my remove function >>> function removethismember(){ $(this).closest('.pnorppl'...

Loading dataset in R -

i'm trying load new dataset in r in same working directory( "c:\r" ) e.g "aust.rda" not working x <- "aust.rda" data( x ) warning message: in data(x) : data set ‘x’ not found i've tried data( "aust.rda" ) warning message: in data("aust.rda") : data set ‘aust.rda’ not found the .rda files loaded using load(), not readrds(). use load() , check environment. variables there. use ls() see available variables. also, @roman-luÅ¡trik mentions in comment, please check file path.

Xillinx VHDL code error -

i trying write vhdl code gives me more trying write code sequential 5 states ( s0 , s1 , s2 , s3 , s4) library ieee; use ieee.std_logic_1164.all; entity seqq port ( seq , clk , reset : in std_logic; output : out std_logic; leds : out std_logic_vector( 2 downto 0) ); end seqq; architecture behavioral of seqq type states ( s0 , s1 , s2 , s3 , s4); signal nxt , prst : states ; begin fb:process(reset, clk) begin if rising_edge(clk) if reset = '1' prst <='0'; else prst <= nxt ; end if ; end if ; end process fb;comb:process( prst) begin case prst when s0 => if seq = '0' nxt <= s0; elsif seq = '1' nxt <= s1; end if ; leds <= "000"; output <= '0'; when s1 => if seq = '0' nxt <= s2; elsif seq = '1' nxt <= s1; end if ; leds <= "001"; output <= '0'; when s2 => if seq = '0' nxt <= s2; elsif seq = '1' nxt <= s1; end if ; led...

javascript - how to use if else condition in angularJs -

hi newly angular js, want convert am/pm format in javascript example ( 25-10-2013 18:30 25-10-2013 6:30 pm ) controller file for (var = 0; < $scope.availableslots.length; i++) $scope.availableslots[i].appointmentdate = date.parse(moment($scope.availableslots[i].f).format('mm-dd-yyyy hh:mm')) ; } <div> <button class="btn btn-danger" ng-click="cancelappointment(appointment)">cancel</button> </div> here cancel button should appear if appointment date future date. otherwise, cancel button should hidden. you using ng-show="isfutureday" attribute. <button class="btn btn-danger" ng-show="isfutureday" ng-click="cancelappointment(appointment)">cancel</button> where isfutureday boolean variable in scope, indicates if appointment day future day or not. if future day, isfutureday===true , button visible. otherwise, invisible. for fu...

python - Nltk stanford pos tagger error : Java command failed -

i'm trying use nltk.tag.stanford module tagging sentence (first wiki's example) keep getting following error : traceback (most recent call last): file "test.py", line 28, in <module> print st.tag(word_tokenize('what airspeed of unladen swallow ?')) file "/usr/local/lib/python2.7/dist-packages/nltk/tag/stanford.py", line 59, in tag return self.tag_sents([tokens])[0] file "/usr/local/lib/python2.7/dist-packages/nltk/tag/stanford.py", line 81, in tag_sents stdout=pipe, stderr=pipe) file "/usr/local/lib/python2.7/dist-packages/nltk/internals.py", line 160, in java raise oserror('java command failed!') oserror: java command failed! or following lookuperror error : lookuperror: =========================================================================== nltk unable find java file! use software specific configuration paramaters or set javahome environment variable. =====================...

javascript - Preventing the div element from moving when it toggles some other elements? -

as see in here: http://jsfiddle.net/agonl/4o79p3ww/ , in beginning, on/off button above normal position. know it's because of hiding other div elements when document loaded, how can fix moving problem? thanks. $(document).ready(function() { $(".tog").css({"display":"none"}); $(".onoff").click(function(){ $(".button1").fadetoggle(); $(".button2").fadetoggle(); $(".button3").fadetoggle(); $(".button4").fadetoggle(); }); }); the problem is, toggle between display: none , display: block . if element has display: none required space element not allocated. use opacity:0 make element invisible still requiring it's space , toggle it's visibility this: $(".tog").animate({"opacity": !($(".tog").css("opacity") > 0)}, 500); and if want objects class .tog invisible beginning set in css: .tog{ opacity: 0; } fiddle

machine learning - Why is Decision tree not working as expected in WEKA? -

Image
i following book "machine learning: hands-on developers , technical professionals" create decision tree weka. though followed same process shown in book, not getting same decision tree. using c4.5 (j48) algorithm. data (arff file) @relation ladygaga @attribute placement {end_rack, cd_spec, std_rack} @attribute prominence numeric @attribute pricing numeric @attribute eye_level {true, false} @attribute customer_purchase {yes, no} @data end_rack,85,85,false,yes end_rack,80,90,true,yes cd_spec,83,86,false,no std_rack,70,96,false,no std_rack,68,80,false,no std_rack,65,70,true,yes cd_spec,64,65,true,yes end_rack,72,95,false,yes end_rack,69,70,false,no std_rack,75,80,false,no end_rack,75,70,true,no cd_spec,72,90,true,no cd_spec,81,75,false,yes std_rack,71,91,true,yes expected output my output what doing wrong? it problem book (keeping answer on here can other readers of book). book expects 1 negative case in end_rack category (look (5,1) in author's ...

excel vba - how can to handle the erorr: Run-time error '53' File not found -

it appears when use next code, when try start batch file excel. sub runbatch() call shell(environ$("comspec") & " f:\financial\data\reports\expensesytd\batch1.bat", vbnormalfocus) end sub i have error: erorr: run-time error '53' file not found how can solve issue? what result both dir /b "f:\financial\data\reports\expensesytd\batch1.bat" dir /b f:\financial\data\reports\expensesytd\batch1.bat as not know file run-time error '53' error message refers to, make public environ$("comspec") result e.g. msgbox , check output dir /b %comspec% . and consider change cmd calling /c in syntax follows: call shell(environ$("comspec") & " /c f:\financial\data\reports\expensesytd\batch1.bat", vbnormalfocus) 'or call shell("cmd /c f:\financial\data\reports\expensesytd\batch1.bat", vbnormalfocus) the /c argument ensures cmd window automatically closed when batch file...

html - table-layout:fixed behaves odd on iPhone -

i need responsive table, on small devices add overflow-x:auto parent , table-layout:fixed table. code here html <div class="class1"> <table class="class2">...</table> </div> css .class1{overflow-x:auto} .class2{width:640px,table-layout:fixed} but on iphone when tap rows, tr -s behave strange,the height starting increase. did have same problem or know solution? based on experience problem not in table-layout:fixed or overflow: auto . both of them working fine on devices. can try adding overflow-y:hidden .class1

mysql - PHP prepared statement always returns 1 -

i tryed call function prepared statement stmt= $conn->prepare("select create_user(?,?,?)"); $tt="test"; $stmt->bind_param("sss",$tt,$tt,$tt); $stmt->execute(); echo "return value".$stmt->fetch(); the returnvalue shouldn't 1 function working if call way directly in mysql console function working correctly , applying changes return value allways 1 no matter it's returning on console tried execute statement check if there mistake in function there 4 rows in table $stmt=$conn->prepare("select count(name) users"); $stmt->execute(); echo $stmt->fetch(); the result (it's 1 again) same if $stmt->store_result(); before fetching result i'm working mysql db you have try this: $stmt=$conn->prepare("select count(name) count users"); $stmt->execute(); $stmt->bind_result($count); $stmt->fetch(); echo $count

"Hardware-based" facebook app -

for company developing automated photo-booth. goal capture photo , after quick review publish photo company's facebook page, automated. end registered app, , application conceptually done , works. developers of app can see photos, seems because app not "reviewed facebook" yet. when read required reviewed, facebook needs able test , verify app. impossible because app works in combination hardware on site, , not meant else use it. am solving right way? can approved users, "private" app? i'm not sure go here. if no user authorization involved , use extended page token page (that valid forever), don´t need go through review. set app public in "status & review" section of app settings. the app work without review role in app (admin, developer, tester).

javascript - how deal with dynamic rules in a flow -

i'm using nools rule engine , have necessity of modify rules on fly without impacting rule engine integrity. so far using default 'main' action group store default rules , using specific action group store rules belongs company. if company want change/add/delete rules need create again entire flow. wasn't able find in documentation. me remove flow ( contain rules companies ) , create again seems work rules crud operations. because of started think maybe flow per company better strategy still, if want change rules flow need removed , added again new rules, altered rules , without deleted rules. problem rules modified/deleted/add on fly. my questions: how other rules engines deal dynamical crud operations on rules? should using flow per company ? is there way add/delete/modify rules flow dynamically in nools? is there more rule engine style solution this? any appreciated. thanks i rather work on making object chaining (inheritance) based on ex...

Excel VBA WinHttpRequest saved Credentials -

i wrote following code innerhtml text of website: public function getinnerhtmlbody(byval url string) htmldocument dim responsedocument new htmldocument dim myrequest new winhttprequest myrequest .settimeouts 5000, 5000, 5000, 5000 .setproxy httprequest_proxysetting_proxy, "<proxy_server_ip>:<port>", "*.domain.com" .open "get", url, false '// authentication proxy server '.setcredentials "<username>", "<password>", credentials_for_proxy .send '// debug msgbox .responsetext, vbinformation, .statustext & " - " & .status responsedocument.body.innerhtml = .responsetext end set getinnerhtmlbody = responsedocument end function as can see line .setcredentials commented out. line needed once authenticate proxy server seems login credentials saved, because if exlude row code retrieves htm...

javascript - Easy way to change the FontSize of the whole html document -

is there standard approach changing font size of whole html document? i'm thinking of 2 buttons, 1 increases font size , decreases font size. both of these buttons calls javascript function; function increasefontsize(){ //increase font size whole document } function decreasefontsize(){ //decrease font size whole document } question how do this? there more simple way 1 stated above? edit i'm using bootstrap , comes it's own css each html element. bootstrap defines default (body) font size 14px . one way if use em units on css , can use jquery solution can works. you can set global value on body change that: $(document).ready(function(){ var fontsize = parseint($('body').css('font-size'),10); $('.inc').on('click',function(){ fontsize+=0.5; $('body').css('font-size',fontsize+'px'); }) $('.dec').on('click',function(){ fontsiz...

Using theano to implement maximum likelihood learning in neural probability language model Python -

i'm trying implement maximum likelihood learning neural probability language model in python code of log-bilinear model: https://github.com/wenjieguan/log-bilinear-language-models/blob/master/lbl.py i used grad function in theano compute gradient , try using function train update parameters of model, got errors. here code: def train(self, sentences, alpha = 0.001, batches = 1000): print('start training...') self.alpha = alpha count = 0 rare = self.vocab['<>'] #print rare q = np.zeros(self.dim, np.float32) #print q delta_context = [np.zeros((self.dim, self.dim), np.float32) in range(self.context) ] #print delta_context delta_feature = np.zeros((len(self.vocab), self.dim), np.float32) #print delta_feature sentence in sentences: sentence = self.start_sen + sentence + self.end_sen pos in range(self.context, len(sentence) ): count += 1 q.fill(0) featurew = [...

rest - Transaction safety in RESTful APIs -

i wonder how establish transaction safety in restful apis, built around single entities. example database model: invoice item user-performed steps in browser: change order number. add item. remove item. edit item. requests made: patch / put invoice data/order number. post item. delete item. patch / put item. issue if after of requests above error happens, further calls might mess data integrity. additionally previous requests have made undone. e.g. if deleting item fails, steps 1 , 2 have rewound in order overall invoice how before. another problem might arise browser crash, dying internet connection, server failure or whatever. how can 1 make sure actions executed in kind of transaction maintain data integrity , safety? so thing remember rest "state transfer" bit. not telling server steps needed update resource, telling server state resource should in after update, because have updated on client , transferring new state on ...