Posts

Showing posts from March, 2013

recycler view reset items - android -

Image
i've been working on app quite time now. app supposed take family names , measure visit time, constant(30 minutes). have family object holds info such name, number of members , end of visit, represented future milliseconds value. the way i've implemented timers part create class called countdownmanager responsible updating , calculating remaining time families' view holders listed. the problem is, if clean data(holders , dataset) , add new family, family not added countdowntimer class. here image when family added correctly: and here image after clean data , try add new family: here codes adapter, view holder , counddownmanager class: package bikurim.silverfix.com.bikurim.adapters; import android.content.context; import android.graphics.drawable.drawable; import android.support.v4.content.contextcompat; import android.support.v7.widget.helper.itemtouchhelper; import android.util.log; import android.view.layoutinflater; import android.view.view; import and

javascript - External library (AJV) is not recognized when using Dojo -

i'm trying use json schema validator ( ajv ) , sample code provided works fine in jsfiddle when use plain java script this ajv test - jsfiddle no library (pure javascript) var ajv = ajv({allerrors: true}); var schema = { "properties": { "foo": { "type": "string" }, "bar": { "type": "number", "maximum": 3 } } }; var validate = ajv.compile(schema); test({"foo": "abc", "bar": 2}); test({"foo": 2, "bar": 4}); function test(data) { var valid = validate(data); if (valid) console.log('valid!'); else console.log('invalid: ' + ajv.errorstext(validate.errors)); } but when try use same exact code above in conjunction dojo ajv test - jsfiddle using dojo 1.10.4 i error fiddle.jshell.net/pbq2yjxy/18/show/:50 uncaught referenceerror: ajv not defined how can use ajv library dojo? global require supplie

combine JSON service responses using Camel -

i have 2 resource based services returning data in json format. the first 1 order service returns order details.this contains orderid , list of products including product id , quantity. the other product service returns product details(description,unit price) of product productid passed input it. i want combine these 2 services using camel route, route response order details along product details (description,unitprice,quantity,quantity * unitprice) of each product in order. since both services separately return json not sure how can combine them both return final result. i think have convert each of services's json response java objects , compute details required , using pojo , convert response json , return result. but, not sure if right approach camel or there way use indivdual json responses directly , combine them , return responses . can me on this. you should use content-enrich pattern claus suggested , aggregate response product service body of

sql server - I dont get all rows with the contain function -

i have varchar(max) , create full text index. use query: select * mytable contains(field, '68396.68403.'); but have 1 result, row has value "68396.68403". have more rows "68396.68403.xxxx", "68396.68403.yyy", etc. don't result. contais "68396.68403.". what problem? i using sql server 2014 express , stopword using "system". if stopword have query: select stopword sys.fulltext_stopwords i don't have row. thank much. try using prefix: select * mytable contains(field, '68396.68403.*');

php - MySql : Can I use query results in nested queries as a variable? -

i'm trying save server resources , reduce number of queries what need use variable holding query result in query nested query $names = ("select * table username 'm%'"); this return names starting m in table later want use $names nested query $myname = ("select * $names username='mohammad'"); i saw answer suggests create temp table first query result in memory not need, because i'll keep $names long time , can't keep table in memory time, drawn server resources. i tried syntax above , many ways similar didn't work i don't want in 1 query because execute nested query every time need use $names $myname = ("select * ("select * table username 'm%'") username='mohammad'"); because need first result separate variable use in other places of script. edit i need first query because i'll many queries based on like $name = ("select * $names username='many

mongodb - Mongo DB find() query error -

i new mongodb. have collection called person . i'm trying records without _id field query: db.person.find({}{_id:0}) but error syntax error: unexpected { but if write db.person.find() it works perfectly. consider following documents inserted in person collection db.person.insert({"name":"abc"}) db.person.insert({"name":"xyz"} if want find exact matching use query db.person.find({"name":"abc"}) this return matched name documents if want names without _id use projeciton id query db.person.find({},{"_id":0}) which return { "name" : "abc" } { "name" : "xyz" }

Django Ajax post 500 internal error -

i hope can me, im trying make django post form without reloading page using ajax, im getting error 500 when submit, can me fix this, code: models.py class productoconcepto(models.model): producto = models.foreignkey(producto) orden = models.foreignkey(cobro) cantidad = models.floatfield() urls.py from django.conf.urls import patterns, include, url django.contrib import admin cobro import views urlpatterns = [ url(r'^cobro/agregar_concepto/$', views.addconcept_product, name='add_concepto'), ] views.py def addconcept_product(request): if request.method == 'post': if form.is_valid(): producto = request.post['producto'] orden = request.post['orden'] cantidad = request.post['cantidad'] productoconcepto.objects.create(producto=producto, orden=orden, cantidad=cantidad) return httpresponse('') template <div class="m

javascript - How to create and upload a video to parse server? -

i able upload image file s3 using parse server. (by creating parse file base64 image data , doing save() on parse file) how can same thing video file? doing using parse-server js library in ionic 2 app typescript. below code worked images. let file = new parse.file("thumbnail", { base64: imagedata }); file.save().then(() => { // file has been saved parse. console.log("file uploaded...."); }, (error) => { // file either not read, or not saved parse. console.log("file upload failed."); }); in case of video file, have file location received cordova media capture callback. me in uploading video file. thank you here solution after days of research. works iphone. important statement this: data=data.replace("quicktime","mov"); var options = { limit: 1, duration: 30 }; navigator.device.capture.capturevideo(function(files){ // success! audio

css - How do I make an icon disappear on mobile? -

hopefully simple answer. have page on desktop needs series of share icons (fb, tw, ig) underneath paragraph of text. on mobile, these icons included in template don't need them show. looks repetitive. using cms , have access body text of page, not headers, extensive javascript isn't ideal. inline css styling or other such magic make div disappear? , can shrink on verified mobile devices or better browser window size? currently code simple: <html> <body> text here. <div id="mydiv"> <img src="/some/icon1.png"> <img src="/some/icon2.png"> <img src="/some/icon3.png"> </div> </body> </html> all need make "mydiv" disappear if i'm using iphone, ipad, or android device... thank you! you can use media queries: a media query consists of media type , 0 or more expressions limit style

sql - Spark - searching spatial data - partition pruning -

i have large quantity of geotagged rows - hundreds of millions - need query using spark sql doing distance calculations points. sql works ok using basic triginometry , haversine distance function. result set returned latitude between +/- meters latitude point, , same longitude; ordered distance desc, , top-n find closest points. far good. data global, storing points in memory inefficient. my questions: how benefit realize using partitioning pruning partitioning data latitude ranges, longitude subranges? reduce search area 1-3 latitude partitions, , < 10 longitude subpartitions. lot less data; dont know spark sql optimizer can prune partitions , subpartitions. unclear if partition pruning on cached rdd particularly beneficial. there no join involved. i partition using parquet files, , subsequently read in parquet partitions needed, instead of data. there other file format should use has partitioning capability? you'll benefit partition pruning when initial re

windows - Issue with a batch file I created. It adds a user correctly but won't remove -

i have 40 .txt files named after 40 of users computer , each .txt file contains users ad account. following bat script works great @ injecting ad account administrator group. mkdir "c:\newtemp\a_accounts" xcopy "\\servername\folder\a_accounts\%computername%.txt" "c:\newtemp\a_accounts" /f "usebackq" %%x in ("c:\newtest\a_accounts\delete\%computername%.txt") (net localgroup administrators %%x /add) however, if make new bat file , reverse switch /add /delete doesn't work on new script. have use script above able delete other users local admin group. mkdir "c:\newtemp\delete_user_admin" xcopy "\\servername\folder\delete_user_admin\%computername%.txt" "c:\newtemp\delete_user_admin" /f "usebackq" %%g in ("c:\newtemp\delete_user_admin\%computername%.txt") (net localgroup administrators %%g /delete) when /f runs doesn't (no errors neither. shows line). has me stunned why beh

php - Failure to launch Homestead Vagrant Box -

i in middle of following laravel tutorial directs me installing homestead vagrant box; stuck on composer part. i use ubuntu 14.04 lts (64bit) , ran vagrant through virtualbox 5.0.24r108355 (amd64). apparently homestead has conflict virtualbox 5.1. my understanding of homestead set ubuntu 16.04 git php 7.0 hhvm nginx mysql mariadb sqlite3 postgres composer node (with pm2, bower, grunt, , gulp) redis memcached beanstalkd this partly confirmed following: 16.04 lts installation. yhk@home:~/homestead$ vagrant ssh welcome ubuntu 16.04 lts (gnu/linux 4.4.0-22-generic x86_64) * documentation: https://help.ubuntu.com/ last login: fri jul 15 13:20:08 2016 10.0.2.2 however, when try vagrant up , fails. apparently, using composer. how proceed along fix glitch , have vagrant , running properly? yhk@home:~/homestead$ vagrant bringing machine 'default' 'virtualbox' provider... ==> default: checking if box 'laravel/homestead' date... ==> default: machi

authentication - Current user doesn't persist when reloading an app (Ionic2 + Parse Server) -

i'm working on ionic 2 app parse server backend. i implemented signed process. no problems here, works expected: new account created, user logged in after sign , current user exists. now want use current user , bypass sign up/login page next time user opens app (if user logged in ). parse documentation states: “it bothersome if user had log in every time open app. can avoid using cached current parse.user object. whenever use signup or login methods, user cached in localstorage.” in case, however, can't manage make work. create current user according parse documentation during initialization process of app: var currentuser = parse.user.current(); if (currentuser) { // stuff user } else { // show signup or login page } every time open app after successful sign current user null. any ideas? i kinda understand what's going on, still don't understand why. during signup or login parse supposed save current use

ios - How can i present different webview based on localization? -

i have app want localize multiple languages. terms , conditions page web address, , each language support has different link. in controller present web view, how can "localize" link, switch links based on locale? to build off of randy's answer you'd want have following code site: objective-c: // getting url language nsstring *websitestring = nslocalizedstring(@"website", nil); // calling said url [self.webview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring: websitestring]]]; swift: // getting url language let websitestring = nslocalizedstring("website", comment: "language"); // calling said url uiwebview.loadrequest(webviewinstance)(nsurlrequest(url: nsurl(string: websitestring)!)) and in localizable.strings file language: // "language" differ various supported languages "website" = "https://destination.com/language";

Identity 3.0 Entity Framework Core 1.0 Foreign-Key -

i'm trying wire one-to-many relationship between company , applicationuser : identityuser . in applicationuser class have: public class applicationuser : identityuser { [foreignkey("companyid")] public int companyid { get; set; } } public class company { [key] public int companyid { get; set; } public string name { get; set; } ... } but receive system.argumentexception: microsoft.entityframeworkcore.infrastructure.idbcontextfactory 1[tcontext]' violates constraint of type 'tcontext' you can setup relation this. public class applicationuser : identityuser { public company company { get; set; } }

java - Run a Cypher query from Spring to Neo4j -

i have uploaded csv file , have nodes , relationship defined on neo4j. i've tried create program base on example run cypher query spring generate output neo4j. however, i'm encountering error: exception in thread "main" java.lang.nosuchmethoderror:org.neo4j.graphdb.factory.graphdatabasefactory.newembeddeddatabase(ljava/io/file;)lorg/neo4j/graphdb/graphdatabaseservice; @ org.neo4j.connection.neo4j.run(neo4j.java:43) @ org.neo4j.connection.neo4j.main(neo4j.java:37) i'm wondering possibly error? here code: public class neo4j{ public enum nodetype implements label{ issues, cost, reliability, timeliness; } public enum relationtype implements relationshiptype{ applies_to } string rows = ""; string noderesult; string resultstring; string columnstring; private static file db_path = new file("/users/phaml1/documents/neo4j/default.graphdb/import/"); public static void main(string[] args){ neo4j test = new neo4j(); test.run();

apache - Redirect all URLs to a single page in the httpd.conf -

i looking way redirect entire website 1 single domain. want in httpd.conf file. example virtualhost have looks like: <virtualhost xx.xx.xx.xx> servername website.com serveradmin webmaster@website.com scriptalias /cgi-bin/ /usr/local/apache2/htdocs/cgi-bin/ documentroot /usr/local/apache2/htdocs/website customlog logs/website/access_log combined errorlog logs/website/error_log redirect / http://newwebiste.com redirect /xxx http://newwebiste.com </virtualhost> currently redirects above still keep full url. so if want http://webiste.com/test/thispage.html redirect http://newwebsite.com/test/thispage.html . want go newwebsite.com , lose rest. so.. http://webiste.com/test/thispage.html to http://newwebsite.com what need add httpd.conf achieve this? thanks, as have noticed redirect catches , sends same uri target don't want, use redirectmatch, match possible requests, not adding target url. so can use: redirectmatch ^ http://newsite.example

javascript - How to add a side-navigation in polymer -

Image
i want add side navigation side: https://www.google.com/design/spec/material-design/introduction.html there should menu button , sidenav opens: but cant find method in polymer . possibility paper-drawer-panel opend time... my working paper-drawer-panel example: https://www.sese7.de/polymer/ has idea how polymer or maybe https://customelements.io/ thanks in advance ;) try setting forcenarrow attribute true. below documentation paper-drawer-panel api docs: https://elements.polymer-project.org/elements/paper-drawer-panel forcenarrow boolean default: false if true, ignore responsivewidth setting , force narrow layout.

Refresh The fragment on download complete in android -

i want refresh or restart fragment when download completes (download manager) code must inside fragment class. i used broadcast receiver restart fragment on download complete. code doesnt work. myfragment.java broadcastreceiver oncomplete=new broadcastreceiver() { public void onreceive(context ctxt, intent intent) { toast.maketext(getactivity(), "download complete", toast.length_long).show(); getactivity().getsupportfragmentmanager().begintransaction() .detach(gettargetfragment()) .attach(gettargetfragment()).commit(); } }; getactivity().registerreceiver(oncomplete, new intentfilter(downloadmanager.action_download_complete)); use async task download. check below link on how refresh or restart fragment. refresh fragment @ reload

ios - Add UDIDs to provisioning profile without using Apple Developer Portal -

my question different other similar questions because similar ones asked during time apple developer portal down due hacking. is there way automate addition of new udids provisioning profile? i work company beta app has slow-rollout of 20 thousand user private beta existing customers . in other words, don't want manually add 20k udids adp on next 6 months. keep in mind, need ask user email address, send them email in beta manager, them open email click link can udid, need manually open adp add it. of needs done before update profile in xcode, archive build deploy them. in interest of sanity , using time efficiently fix bugs beta users report, whole process seems insane. we've added 50 way , it's driving me nuts. i thought fabric beta might handle nicely me, doesn't. is there command line interface adding udids? or, there way invite users via email, , if open email on device, can install our beta app without me needing add udids manually in adp first?

sas - Using Date as Constant in expressions -

i'm having trouble calling date within if statement. date is, example, "2001-08-05". trying subset data based on date. code: if id = "yes" , date > 2001-08-05 delete; but doesn't i'm asking. don't error, doesn't perform ask. tried "2001-08-05"d. produced error. there way read format? the proper format date constant in sas 'ddmmmyyyy'd , so: if id = 'yes' , date > '05aug2001'd you can use either single or double quotes delimit constant. month name in constant case insensitive. on side-note, if need date-time constant in sas, format 'ddmmmyyyy:hh:mm:ss'dt . notice suffix becomes dt rather d , there semi-colon between date , time.

r - How to use function with passing function has reactive as input in shiny -

i have little problem. have build package called d3k can used across different dashboard. 1 of function follows: conditionalrendervaluebox <- function(value, title, red_limit, yellow_limit){ rendervaluebox( valuebox(value, title, color = if(class(value)=="character" | is.na(value)){ "blue" }else if(value>red_limit ){ "red" }else if(value>yellow_limit){ "yellow" }else{ "green" } )) } now trying pass value parameter in function, parameter reactive value. server.r library(lubridate) # library(googlevis) # library(readr) library(shinyjs) library(ggplot2) library(plotly) library(d3k) library(dplyr) server <- function(input, output, session) { v1 = reactive({ input$v1 }) f <- reactive({ if(is.na(v1())){ "wai" }else{ runif(1, 1, 10) } }) output$t <- conditionalrende

mysql - converting date to timestamp in hive -

i have table in rdbms, date format '1986-12-01'. using hive .08 not .12. while import data hive null timestamp, there option populate data in table directly file(the data pretty big). or have use a stage table string , use function convert data timetamp, if like? thanks ! i answer based on mysql, because see tag rdms name in post. then, have 3 options. 1.- filtering on sqoop query side i assume here import data using sqoop . tool have option allows export result of sql query. in query use mysql method, unix_timestamp(date, format) , transform date timestamp. sqoop instruction this: sqoop import --connect jdbc:mysql://mysqlhost/mysqldb --username user --password passwd --query "select col_1, ..., unix_timestamp(str_to_date(date_col, '%y-%m-%d')) table1 \$conditions" -m 1 --target-dir hive_table1_data` notice where \$conditions mandatory . furthermore i've assumes here date colum string. if date type, method str_to_date not neede

How to do a GET request on PHP using CURL -

i have simple request trying make , results back. have tried in postman without headers or body , works fine. have put in browser , returns result. but, when in php not getting anything. code looks like. doing wrong? $curl = curl_init(); curl_setopt($curl,curlopt_url,'http://********/vizportal/api/web/v1/auth/kerberoslogin'); curl_setopt($curl,curlopt_returntransfer, true); curl_setopt($curl, curlopt_post, 0); curl_setopt($curl, curlopt_connecttimeout, '20'); $resp = curl_exec($curl); echo $resp; use header send header browser server : $curl = curl_init('http://********/vizportal/api/web/v1/auth/kerberoslogin'); curl_setopt($curl, curlopt_post, 0); curl_setopt($curl, curlopt_connecttimeout, '20'); curl_setopt($curl, curlopt_returntransfer, true); // curl_setopt($curl, curlopt_header, true); // curl_setopt($curl, curlinfo_header_out, true); // enable tracking curl_s

javascript - vuejs component template files -

i'm looking build simple spa vue.js. i'd load different templates , animate transition between them this: http://codepen.io/michaeljcalkins/pen/bnqrez the example great, i'd load each component's template separate file. something like: var foo = vue.extend({ template: '/foo.html' i went through documentation can't seem find anything. how go achieving this? thank you! as mentioned björn above, doesn't it's possible use template url's in vue. björn!

javascript - How to divide result given in html() jquery? -

i'm trying create function click button , content <div> . after, need divide content. mean, if div has 10 children, need save 5 children in var code1 , other 5 in var code2 . problem i'm not able use html() function. code looks like: $(".pluscontrol").click(function(){ var id = $(this).attr("id"); var items=$(this).closest("table").parent().next().children('#'+id).children().length; var middle = items / 2; var code1=""; $(this).closest("table").parent().next().children('#'+id).html( function(index,currentcontent){ if (index < middle ) code1 = code1 + currentcontent; }); if ( $(".modal-body .row .sdiv").attr("id") == 1 ) $(".modal-body .row #1.sdiv").html(code1); if ( $(".modal-body .row .sdiv").attr("id") == 2 ) $(".modal-body .row #2.sdiv").html("...");

sql server - update specific rows on table1 with specific values when table1 matches table2 and table 2 row contains a specific level -

i've tried search i'm not getting proper criteria valid search return. if show this, have answer. in sql server. doesn't work, here trying do. update rating r set category1 = 1000, category2 = 500, category3 = 100 yearnbr = 2014 , weeknbr = 0 , (select * team t r.teamnbr = t.teamnbr , t.tierlevel = 1) rating has: teamnbr int, yearnbr int, weeknbr int, category1 int, category2 int, category3 int team has: teamnbr int, teamname varchar(50), tierlevel int basically, need update rating table specific values rows have yearnbr of 2014 , weeknbr of 0, , want rows have tierlevel = 1 on team table matches on teamnbr both tables. have 5 different tierlevels , change category values , tierlevel in statement , run 1 time each tierlevel. thanks in advance. robert update r set r.category1 = 1000, r.category2 = 500, r.category3 = 100 rating r inner join team t on r.teamnbr = t.teamnbr

assembly - PIC32 speed : Optimizing c code -

i want suggestions optimize code simple 1 need fast , fast mean less 250 ns. first code slow , 1000 ns after works 550 ns believe can done faster don't know how :< using pic32 80 mhz system clock code: void main() { unsigned long int arr_1[4095]; unsigned long int arr_2[4095]; //here assign arr_1 , arr_2 values //... //... trisc = 0; trisd = 0; while(1){ latc = arr_1[porte]; latd = arr_2[porte]; } } as can see simple job, problem speed. saw assembly listing see how many instructions there , don't know assembly language optimize it. ;main.c, 14 :: latc = arr_1[porte]; 0x9d000064 0x27a30000 addiu r3, sp, 0 0x9d000068 0x3c1ebf88 lui r30, 49032 0x9d00006c 0x8fc26110 lw r2, 24848(r30) 0x9d000070 0x00021080 sll r2, r2, 2 0x9d000074 0x00621021 addu r2, r3, r2 0x9d000078 0x8c420000 lw r2, 0(r2) 0x9d00007c 0x3c1ebf88 lui r30, 49032 0x9d000080 0xafc260a0 sw r2, 24736(r30) ;main.c

ios - How to change the swipe direction of UISwipegestureRecognizer using @IBAction -

for reason won't work, doing wrong here? the second option is: creating uiswipegesturerecognizer() then setting using .direction = .up and adding using addgesturerecognizer() works. want using code below. class faceviewcontroller : uiviewcontroller { @iboutlet weak var labelvar: uilabel! // mark: gestures @ibaction func swiping(sender: uiswipegesturerecognizer) { sender.direction = .up self.test() } func test() { labelvar!.text = "up" } }

javascript - How to combine treetable in datatable using fixed column -

hi facing issue regarding combining treetable in datatable using fixed column on expand , collapse. here code tried out. please me out solve issue. $("#example").treetable({expandable:true}); $('#example').datatable( { scrollx: true, fixedcolumns: true, "scrollx": true, } ); <link href="http://ludo.cubicphuse.nl/jquery-treetable/css/jquery.treetable.css" rel="stylesheet" /> <link href="http://ludo.cubicphuse.nl/jquery-treetable/css/jquery.treetable.theme.default.css" rel="stylesheet" /> <link href="http://cdn.datatables.net/1.9.4/css/jquery.datatables.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://cdn.datatables.net/1.10.4/js/jquery.datatables.min.js"></script> <script src="https://cdn.

matlab - Function as a parameter -

i have function in .m file: function [func diff1 diff2]=fun(x) func=(3*x^3)+6; diff1=(3*(x+0.00000001)^3-3*((x)^3))/0.00000001; diff2=(3*((x+0.00000001)^3)-2*3*(x^3)+3*(x-.00000001)^3)/(.00000001^2); end in second function want able pass in function parameter. keep getting "attempted access fun(3); index out of bounds because numel(fun)=1." does have ideas? function [x,n,fval]=halley(fun,guess,tol); fval=fun(guess); end you need pass function handle when calling halley : halley(@fun, 3, 0.1)

python - package.json not npm installing -

okay, when try , install nodes through npm install, have jut began programming , baffled me..., ideas or thoughts? (please dumb down) c:\users\jason\webstormprojects\test project\node_modules\kerberos>if not defined npm_config_node_gyp (node "c:\program files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) gyp err! configure error gyp err! stack error: can't find python executable "python", can set python env variable. gyp err! stack @ failnopython (c:\program files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14) gyp err! stack @ c:\program files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11 gyp err! stack @ fsreqwrap.oncomplete (fs.js:82:15) gyp err! system windows_nt 6.3.9600 gyp err! command "c:\\program files\\nodejs\\node.exe" "c:\\program files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node

C++ Passing a local variable -

i can not figure out pointer wrong in code. however, receive error code not have pointer-to function. #include <iostream> using namespace std; char uppercase (char ch) { if ((ch >= 'a') && (ch <= 'z')) { return ch - 'a' + 'a' ; cout << "your capital letter " << ch << endl; } else { return ch; cout << "your original letter is: " << ch << endl; } } int main(int& ch){ cout << "please enter lowercase letter between z: "; cin >> ch; char uppercase; char outchar; char inchar; outchar = uppercase(inchar); system("pause"); } int main(char&) not strictly-conforming. may provided implementation don't know of platform doing this. on hosted implementation, use int main() or int main(int argc, char** argv) instead. building on 1 st note, declare ch in f

compiler construction - How to track the index of variables in an interpreter -

i'm creating interpreter (a bytecode interpreter, compiler) , i've found problem can't solve. need store variables somewhere. storing them in dictionary , looking them @ runtime way slow, i'd store them in registers , use indexes instead of name. so @ compile time give every variable index, , create array of registers. that's fine monolithic scoped languages. language i'm creating interpreter has nested scopes (and function calls). approach have set of global registers, , stack of register lists function calls. virtual machine have like: register globalregisters[number_of_globals]; stack<register[]> callstack; but there's thing. language allows functions inside functions. example: var x = 1; function foo() { y = 2; function bar() { z = 3; y = y - 1; } } function bar() refers variable belongs foo(). means virtual machine have @ register list under top 1 on stack. if bar() recursive? if number of recursions defin

vb.net - Why doesn't class become disposed when exiting application? -

i can't remember have been getting error "object disposed exception" time ago, while testing , closing app. need dispose each object manually? or what's proper way of using controls / objects? the error indicated line in main form: private th new sellertimerhandler i error hardly (i can't test it) wonder general idea avoid taking space in memory unnecessarily, not when executing , closing after crashings. a system.objectdisposedexception thrown when trying access object disposed. exception has nothing class/an object not being disposed. when application closes don't need objects/resources windows takes care of you. disposing , garbage collecting of objects needs performed during runtime in order free memory application able continue operate, , not eat ram. when process running operating system has full knowledge on all system resources using; meaning when process closes, os frees memory used (this applies when process crashes too) .

javascript - How to use wow.js for a web page that show content from bottom to top -

i want use wow js animations web page inverse scrolling. when page loads scroll bar @ top. shows content @ bottom of page. in natural scroll,bottom content slide down , top content displayed accordingly. used wow js animations not visible , not animating till scroll bottom of page.(in case scroll bar @ bottom , bottom content displayed) tried editing wow.js file i'm not @ js. grateful if me find solution. thank you.

c# - Entity Framework 6 - Group by then Order by the First() takes too long -

i need 1 , couldn't find related answers after hours of searching. mysql, entity framework 6, database few millions of records, record looks like: indexint(11) not null taskidint(11) not null deviceidbigint(20) not null commentslongtext null extendedresultslongtext null runresultint(11) not null jobresultint(11) not null jobresultvaluedouble not null reporteridbigint(20) not null fieldidbigint(20) not null timeofrundatetime not null what need records specific taskid, group deviceid , sort timeofrun in order latest data each deviceid in specific taskid. this code: list<jobsrecordhistory> newh = db.jobsrecordhistories.asnotracking().where(x => x.taskid == taskid).groupby(x => x.deviceid). select(x => x.orderbydescending(y => y.timeofrun).firstordefault()).tolist(); but generated query: {select apply1 . index , apply1 . taskid , apply1 . deviceid1 deviceid , apply1 . runresult , apply1 . jobresult , apply1 . jobr

mongodb - Number of Imported Documents using mongoimport does not match documents in database -

i using heroku mongolab add-on, , using mongoimport import documents. when run command, mongoimport works , tells me imported 9479 documents, correct. however, when check database, there 5000 documents. (it seems switch between 4999 or 5000). tried operation multiple times same results. why happening?

jquery - Play Soundcloud Audio Streams with Jplayer -

hey want able play public soundcloud stream jplayer. thought of using soundclouds own api method, registered app , tried use http://api.soundcloud.com/tracks/trackid/stream?client_id=client_id this works in browser when visit link in current code need link ending .mp3 play audio. since soundloud using 302 redirect mp3 url, isnt working. current code grabbing audio url $(document).ready( function() { if (getcookie("volume")=="") { player_volume=0.8; setcookie("volume",0.8,"365") } else { player_volume=getcookie("volume") } $("#sound-player").jplayer({ready:function(a) { $(this).jplayer("setmedia",{})},cssselectorancestor:"#sound-container",swfpath:"themes/sound/js",supplied:"mp3",wmode:"window",volume:player_volume,smoothplaybar:true,keyenabled:true}) }); function playsong(c,e) { if (/opera mini/

ruby - Can I grant access to an entire chef_vault or only individual vault items -

i'm learning chef_vault. i can go vaults , grant admins , clients (nodes) access vault items inside vaults, there way can grant admins , clients access entire vault , contents? is there mechanism add , remove access entire vault , view access? not specifically. every vault item encrypted separately. make scripts call knife vault update same access parameters every item in bag though.