Posts

Showing posts from February, 2014

ruby - Rails - Is it hacky to manually list my form options as strings within the select_tag helper? -

is hacky manually list form options strings within select_tag helper? also, i'm wondering--how use selected value update database? <div class="form-group"> <%= f.label :sex %><br /> <%= select_tag(:sex_id, options_for_select( [ ["not known", 0], ["male", 1], ["female", 2], ["not applicable", 3] ] )) %> this question outlines process of using enum in activerecord (rails 4.1+) mapping integers. an attribute of type integer in database can declared in corresponding model (i assume user ): enum gender: [:not_known, :male, :female, :not_applicable] in view, may rely on fact system wants corresponding strings, not integers: <%= f.input :gender, as: :select, collection: user.genders.keys %> or map them generate want: "human-readable names" or i18n keys: <%= f.input :gender, as: :select, collection: user.genders.keys.map { |w|

mongodb - How to change datatype of netsted field in mongo document? -

my mongo structure below, "topprocesses" : [ { "cpuutilizationpercent" : "0.0", "processid" : "1", "memoryutilizationpercent" : "0.1", "command" : "init", "user" : "root" }, { "cpuutilizationpercent" : "0.0", "processid" : "2", "memoryutilizationpercent" : "0.0", "command" : "kthreadd", "user" : "root" }, { "cpuutilizationpercent" : "0.0", "processid" : "3", "memoryutilizationpercent" : "0.0", "command" : "ksoftirqd/0", "user" : "root" }, {

How to implement an ETL Process -

i implement synchronization between source sql base database , target triplestore. however matter of simplicity let 2 databases. wonder approaches use have every change in source database replicated in target database. more specifically, each time row changes in source database can seen process read changes , populate target database accordingly while applying transformation in middle. i have seen suggestion around mechanism of notification can available in database, or building tables such changes can tracked (meaning doing manually) , have process polling @ different intervals, or usage of logs (change data capture, etc...) i'm puzzle of this. wonder if give guidance , explanation different approaches respect objective. meaning: name of methods , look. my organization uses: postgres , oracle database. i have take relational data , transform them in rdf store them in triplestore , keep triplestore synchronized data sql store. please, many thanks ps:

algorithm - Game of flipping two consecutive positives to negatives -

i asked questions in 1 of interviews. questions goes this you have string of '+' , '-' ( eg. ++----++++++-+--+ ). there 2 players player 1 , player 2. @ each turn 1 of player can choose 2 consecutive '+' i.e. ++ , flip them --. if initial string ++----++++++-+--+ , player has following 6 choices (2 - 7) .(first 1 reference). ++----++++++-+--+ ------++++++-+--+ ++------++++-+--+ ++----+--+++-+--+ ++----++--++-+--+ ++----+++--+-+--+ ++----++++---+--+ the player takes turn 1 one. player plays last move win ( or lose - doesn't make difference). given initial string , if player 1 takes first turn, have tell wins? now seems classical game theory problem each player tries play optimally , @ each step plays move moves him winning position. any ideas on how can approach solve ? ps - interested more in approach in solving. have read http://www.codechef.com/wiki/tutorial-game-theory couldn't apply same logic here. we can use grun

java - Staggered two dimensional arrays? -

so have bunch of id numbers align sort of tree.... example 1 3082 2986 / \ / \ 2 1233 2344 1233 1634 / \ / \ / \ 3 0254 0456 1342 0653 0643 0463 how make array of array fit scheme or there else do? know make 2-dimensional array (string[][] array = new ...) size each tree different , unknown. 1x1 , others 3x5, @ largest. don't want have make array large either, @ least don't think do. i using java , starts in jsonarray way. update: have added examples of id numbers be, kind of irrelevant. if combined 0643 , 0463 1634, if combined 1643 1233, final item 2986. again irrelevant how works. i want know if possible make 2-dimensional array if size of array unknown, can see column 1 contain 1 id number, column 2 contain 2 id numbers , in cases 1 or 3 id numbers, , column 3 can conta

siebel - How do I ascertain the CONTACT linked to an S_EVT_ACT record? -

apologies if basic i'm new siebel. i have 4 activity record ids , need find out contact attached in database. i'm assuming join somewhere, don't know schema enough , can't see obvious contact id in s_evt_act table. i figured out. the s_contact row_id exists in target_per_id column of s_evt_act table. if can't can use s_act_contact intersection table.

virtualbox - vb.customize 'storageattach' mounts my disk first time, but changes are lost after vagrant halt ; vagrant up -

i new vagrant , trying add second disk virtual machine cooking vagrant. figured out how attach disk when vm first booted, when bring machine down , again (with 'vagrant --provision' make sure provisioners run) changes make disk lost. i ran both times logging , log output second run (the reboot after machine provisioned) shows storageattach command being executed. every file create under "/dev/shm" (which seems mount point second disk) disappears. the failure mode is: vagrant ... touch /dev/shm/some.file ls /dev/shm/some.file # see output here... vagrant halt vagrant --provision ls /dev/shm/some.file # no such file or directory.. did go ? any tips appreciated. my vagrantfile is: ... vagrant.require_version ">= 1.4.3" vagrantfile_api_version = "2" disk = './seconddisk.vdi' box_name="test" vagrant.configure(vagrantfile_api_version) |config| config.vm.define :master |master|

c# - How to find out if there is a connection between two arbitrary vertices in direction graph? -

i know classes , functions in quickgraph library (c#) should use, find out, if there exists connection between 2 arbitrary vertices in directional graph? i beginner @ programming, programming alghorithms, kindly ask if can provide me sample code mentioned problem, because quickgraph library doesn't have many problem-specific tutorials beginners.ecially graph specification: directed not weighted (distance not important, connectivity between vertices/edges) graph dynamic vertices/edges can added/removed or edited. hm, haven't tested it, basic dfs/bfs should trick, such: var trygetpaths = _graph.treebreadthfirstsearch(__source__); ienumerable<edge<youritemtype>> path; if (trygetpaths(__target__, out path)) { // have connectivity! } that 1 checks if there connectivity source target . might want run check vice versa too.

file - How to fill a matrix with data in Fortran 90 -

i have issue, maybe stupid, code wrote. generated 30 datasets of 24 lines containing different values represent, however, same measure, can not print them in array format. let me explain, single column values, able write them matrix of 24 rows 30 columns. tried read various threads on site , on others, got matrices of zeros alternating values, how can do? following code wrote trying matrix "a" formed values of "diffu" program deviation implicit none character(len=20) :: filein,fileout,fileinp integer :: row,i,h,io,n,j,l,m,col real :: usv,usf,tsv,tsf,su,st real :: diffu, difft real, dimension(24,30) :: real, dimension(720) :: u n = 39 row = 24 col = n-9 write(*,'(2x,''input file .......''/)') read(*,'(a15)') filein write(*,'(2x,''output file........''/)') read(*,'(a15)') fileout open(unit = 20,file=fileout) = 0. fileloop : = 10,n fileinp = 'lin*27-' write(fileinp,

tortoisehg - How to use HG(Mercurial) in command prompt? -

Image
how can open hg in command prompt in directory? i have tried setting classpath. nothing works.. i need use hg below picture wherever in directory. you must have path c:\program files\tortoisehg\ in path variable open control panel -> system -> advanced system settings -> advanced tab -> environment variables make sure under path variable have c:\program files\tortoisehg\ included

javascript - Js lodash return the same sample every time -

i want generate samples lodash , return me same numbers each line. im doing wrong? var primarynumscells = _.range(50); var extranumscells = _.range(20); var lottery = {lineconfigurations: []}; var numsconfig = {linenumbers: {}}; for( var = 0; < 2; ++ ) { numsconfig.linenumbers.primarynumbers = _.sample(primarynumscells, 5); numsconfig.linenumbers.secondarynumbers = _.sample(extranumscells, 2); lottery.lineconfigurations.push(numsconfig); } console.log(lottery); the results of first object , second object of primary , secondary numbers same; here fiddle: http://jsbin.com/vavuhunupi/1/edit create new object inside loop. it's easy plain object literal (dropping variable): var lottery = {lineconfigurations: []}; (var = 0; < 2; i++) { lottery.lineconfigurations.push({ linenumbers: { primarynumbers: _.sample(primarynumscells, 5), secondarynumbers: _.sample(extranumscells, 2) } }); } as stands, @ each s

xpages - Problems using the XSP Starter Kit -

i followed instructions install xsp starter kit openntf. mentioned in video able not able activate it. when activate plugin in application , try open error 500. idea? the server console tells me: https://www.dropbox.com/s/w2a0nlmjj5prnxs/error%20osgi.jpg?dl=0 the log file contains: <extendeddataelements name="commonbaseeventlogrecord:exception" type="string"> <values>java.lang.runtimeexception: com.ibm.xsp.facesexceptionex: javax.faces.facesexception: java.lang.instantiationexception: org.openntf.xsp.starter.renderkit.abstracthtmltagrenderer&#xa;&#x9;at com.ibm.designer.runtime.domino.adapter.componentmodule.initmodule(componentmodule.java:461)&#xa;&#x9;at com.ibm.domino.xsp.module.nsf.nsfcomponentmodule.initmodule(nsfcomponentmodule.java:498)&#xa;&#x9;at com.ibm.domino.xsp.module.nsf.nsfservice.creatensfmodule(nsfservice.java:752)&#xa;&#x9;at com.ibm.domino.xsp.module.nsf.nsfservice.loadmodule(nsfservice

sms - Concatenated PDU Flash message -

i'm trying send concatenated flash messages using sim900 gsm module. both messages sent successfully, can see 1 on cell phone. these pdus i'm using: at+cmgs=140 pdu part 1 = 0051000b916998775706f80010a78f050003790201622c908c059ab1403416a8c602d958a01b0b84638172a0b09b0c8ac158a0188c058ac558a0988c058acd58a0188d058ad558a0988d058add58a0188e058ae55820198c0592c55820998c0592cd5820198d0592d55820998d0592dd5820198e0592e558a0198c059ac558a0998c059acd58a0198d059ad500 at+cmgs=43 pdu part 2 = 0051000b916998775706f80010a72105000379020258a0998d1593cd6839582e3683e564331c2c17c3c96630 is there wrong udh? i'm able send concatenated sms, not flash messages. how can fix this?

r - Retrieving cached oauth token with packages httr, twitteR, and streamR -

the way i've found myself authenticated twitter api following: library(twitter) setup_twitter_oauth(consumer_key = "a", consumer_secret = "b", access_token = "c", access_secret = "d") after running this, can use functions in twitter fine. however, use streamr package, needs token oauth object: filterstream("tweets.json", track = c("obama", "biden"), timeout = 20, oauth=my_oauth) from gather, setup_twitter_oauth function above wrapper around httr functions authorization token. token cached in working directory file called ".httr-oauth". question is: how load file r, such oauth object can use streamr? use readrds() readrds('.httr-oauth') $xxxx0x000xxxx00000x0xx0x000000xx request: https://api.twitter.com/oauth/request_token authorize: https://api.twitter.com/oauth/authenticate access: https://api.twitter.com/oauth

javascript - Using events on dynamic markers -

Image
i have init function in javascript: inicia2 = function(){ console.log("google maps init") //variables declaration var lat,long, cordenadasclientes = clientes.find({}, {fields:{'metadata.latcliente': 1,'metadata.longcliente': 1,'metadata.nombrecliente':1}}).fetch(); //getting geolocation lat = session.get('lat'); long = session.get('lon'); //map options var mapoptions = { center: new google.maps.latlng(lat,long), zoom: 15, disabledefaultui: true, styles:[{"stylers":[{"hue":"#ff1a00"},{"invert_lightness":true},{"saturation":-100},{"lightness":33},{"gamma":0.5}]},{"featuretype":"water","elementtype":"geometry","stylers":[{"color":"#2d333c"}]}], maptypeid: google.maps.maptypeid.roadma

webdriver findelement by xpath <a> <span> C# -

i need create test in webdriver c# click link "text" in menu has structure this: <ul style="overflow: hidden"> <li> <ul class"menu" style="overflow: hidden"> <li class="class_li"> <a href="/level1/leve2"> <span class="class_span">text</span> </a> </li> </ul> </li> <li /> <li /> </ul> classes ""class_li" , "class_span" used many times. cannot modify html code. i tried few different xpath statements everytime got "invalidselectorexception unhandled". how can link , click it? the following xpath select first a link has direct child span text text (//a[span/text()='text'])[1] i'm no selenium expert, should able this: driver.findelement(by.xpath("(//a[spa

python - FieldError at /autocomplete/ItemsAutocomplete/ -

i using autocomplete_light in django model form. this model form class ca_dispensaries_item(timestampedmodel): item = models.foreignkey(items) dispensary = models.foreignkey(ca_dispensaries) description = models.charfield(max_length=5000, null=true) this form class camenuform(autocomplete_light.modelform): class meta: model = ca_dispensaries_item exclude = ('dispensary',) autocomplete_fields = ('item',) registered as autocomplete_light.register(items, search_fields=('item_name')) when try enter values in item , per autocomplete feature, starts searching gives field error cannot resolve keyword u'i' field. choices are: arizona_dispensaries_item, ca_dispensaries_item, colorado_dispensaries_item, created, id dont know i coming from. also, dispensaries_items of models. while created , id field names you have forgottent comma! change search_fields=('item_name') to search_fields=(

sql server - Datatype for Float in SSIS Package -

Image
i have issues float data type in ssis package. i used data type float [dt_r8]. below screen shots. here sample table. customer 1020.29 101.2934 2092.125 2.092126 921.27 in sql : customer 102029 1012934 2092125 2092126 92127 what i'm missing here. read other posts , used [dt_r8] float. i have written flatfile , same. ![screenshots ssis file connection][2] why don't u use data conversion task assist making sure end result float. have feeling initial metadata causing trouble.

javascript - rendering anchor href with json2html -

i trying render anchor json2html following transform: 'rendertimeline':[ { tag: "a", class: "btn btn-warning btn-circle", style: "float: right;", html: "<i class=\"icon-remove\"></i>", "href": function() { var myhref = "javascript:delschedule(" + + ");"; return myhref; } }] intention delete json object,which passed : $('#suntimeline').json2html(sched1.sunday, transforms.rendertimeline, {'events':true}); i following o/p on rendered html: <a class="btn btn-warning btn-circle" style="float: right;" href="javascript:delschedule([object object]);"><i class="icon-remove"></i></a> when click on link(button) message in browser console: syntaxerror: missing ] after element list please me solve issue. assuming trying pass reference of clicked ele

c# - TextBox in master page cleared when redirect another page -

i have master page this: public partial class site1 : system.web.ui.masterpage { public string mytext { { return textbox1.text; } set { textbox1.text = value; } } } site1.master : @ master language="c#" autoeventwireup="true" codebehind="site1.master.cs" inherits="project1.site1" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:contentplaceholder id="head" runat="server"> </asp:contentplaceholder> </head> <body> <form id="form1" runat="server"> <div> <asp:textbox id="textbox1" runat="server"></asp:textbox> <asp:contentplaceholder id="contentplaceholder1" runat="server"> </asp:contentplaceholder> </div>

svn - Bamboo Unable to publish artifact -

i have question artifacts configuration; i'm working automatic build using code source files svn. rq: tasks used in bamboo dos scripts. after successful build, configured artifacts putting /*.bin in copy pattern field. the generated file (bin file) located under workspace (c:\workspace\bin) that's why modified bamboo.artifacts.directory in bamboo.cfg.xml file by: "c:\workspace", , putted "bin" under location in bamboo artifact definition; however, after correctly building project, found in log file following line: "unable publish artifact [xxxxxx]: null" , there no generated artifact. could me please !! most issue either permissions or bamboo doesn't have write access directory outside of bamboo workspace. remember running user run bamboo service as. workspace (where code) , bamboo's workspace (where build happens) 2 different things. better off using default config puts bamboo shared artifacts in bamboo workspace

android - How to open system activity and click button there? -

how app greenify, open system activity , click button there? activity "app info", automatically clicked "force stop" button. , app can click button in activity without root . code open activity "app info" this: intent intent = new intent(); intent.setaction(settings.action_application_details_settings); uri uri = uri.fromparts("package", "com.package.sendinput", null); intent.setdata(uri); startactivityforresult(intent, 0); then activity opened. click button there, have tried execute adb shell input tap 200 340 (using same uid running app), "killed" system. using root can click button. is there other way? thanks in advance edit : (guess work, because haven't done myself) greenify automation done running accessiblity service. in nutshell, retrieves current content of window , sends accessibilityevent s specified views like: touch, focus. content window described accessibilitywi

java - Android Error testing app using Mock Location -

i'm trying test android location based app. it useful if mock location data providers in unit tests. can't add access_mock_location permission androidmanifest.xml because when gives me error: mock locations should only be requested in a debug-specific manifest file (typically src/debug/androidmanifest.xml) using mock location provider (by requiring permission android.permission.access_mock_location) should done in debug builds. in gradle projects, means should request permission in debug source set specific manifest file. fix this, create new manifest file in debug folder , move element there. typical path debug manifest override file in gradle project src/debug/androidmanifest.xml. but when add androidmanifest.xml src/androidtest directory - ignores when testing. what doing wrong? i had problem , think figured out solution. make sure "access mock locations" checked in device developer options (in addition making "src

javascript - angularjs and localStorage change event -

i store data in localstorage what want in angularjs app when data in localstorage changed, app rerender app, how can this? there angular localstorage module: https://github.com/grevory/angular-local-storage var democtrl = function($scope, localstorageservice) { localstorageservice.clearall(); $scope.$watch('localstoragedemo', function(value){ localstorageservice.add('localstoragedemo',value); $scope.localstoragedemovalue = localstorageservice.get('localstoragedemo'); }); $scope.storagetype = 'local storage'; if (!localstorageservice.issupported()) { $scope.storagetype = 'cookie'; } }; after further thought may need change module broadcast on setitem can notified if localstorage has been changed. maybe fork , around line 50: localstorage.setitem(prefix+key, value); $rootscope.$broadcast('localstoragemodule.notification.setitem',{key: prefix+key, newvalue: value}); // broadcast old val

php - composer install fails when unable to see mysql database -

tl;dr: composer install fails when post-install scripts can't see mysql server i'm building docker container symfony application, , during build this run export symfony_env=prod && \ composer install --prefer-dist --optimize-autoloader towards end of install, fails this generating optimized autoload files [doctrine\dbal\exception\driverexception] exception occured in driver: sqlstate[hy000] [2003] can't connect mysql server on '127.0.0.1' (111) [doctrine\dbal\driver\pdoexception] sqlstate[hy000] [2003] can't connect mysql server on '127.0.0.1' (111) [pdoexception] sqlstate[hy000] [2003] can't connect mysql server on '127.0.0.1' (111) script sensio\bundle\distributionbundle\composer\scripthandler::clearcache handling post-install-cmd

gcc - Could someone help me configure MinGW in SublimeText 3? (Newbie) -

i downloaded mingw following first link here https://isocpp.org/get-started , need configure in subimetext 3. know should go tools > build system > new build system... should specify there? i use win7x64. , mingw in c:\mingw the complete reference build systems here . first thing need make sure c:\mingw\bin directory in path , restart sublime change gets picked up. once you've done that, create new build system following contents: { "cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c, source.c++", "shell": true, "variants": [ { "name": "run", "cmd": ["start", "cmd", "/k", "${file_path}/${fil

security - Is it advisable to configure a URL with both post and get? -

i have link on page redirects page request sent through post method. when user refreshes new page request sent through method. url used display page. question is, advisable use both post , same url call or cause problems related security or other? if please explain how. no. use post if link executing unsafe action (e.g. logout, change password) or sending sensitive data not want displayed in url (urls logged default in browser history , many appliances, proxies , web servers). post can used when large amount of information sent. otherwise use get .

controller - Rails: Why isn't the 'create' action saving the newly created Quiz instance? -

my form gets passed 'new' quiz (not saved database). form partial looks this: <%= form_for(@quiz) |f| %> <p> <%= f.check_box(:answer1) %> <%= f.check_box(:answer2) %> <%= f.check_box(:answer3) %> <%= f.check_box(:answer4) %> <%= f.check_box(:answer5) %> <%= f.check_box(:answer6) %> <%= f.check_box(:answer7) %> <%= f.check_box(:answer8) %> </p> <p> <%= f.submit("get results!") %> </p> <% end %> here quizzescontroller#create action: def create @results = quiz.create(post_params) #from private method if @results.save redirect_to results_path else #error handle here end end ...which gets triggered when user clicks 'get results' on quiz form. , post_params method looks this: def post_params params.require(:quiz).permit(:id, :user_id, :answer1, :answer2, :answer3, :answer4, :answer5

asp.net mvc - how to convert viewmodel to accept any model in mvc 4 -

i have mvc 4 application in user can select data source dropdownlist , based on selection search in relevant table using entity framework. data model returned search results view. have created partial view each source results fields different in each data model. code looks this @using sfrs.gazmatching.web.models @model ipagedlist<centraladdrcdoquery> @html.partial("_searchform", searchformviewmodel) <h4>search results</h4> @if (viewbag.iscentraladdrccdoquery) { @html.partial("_centraladdrcdoquery", model) } @if (viewbag.islandbfsladdraddrcdoquery) { @html.partial("_landbfsladdraddrcdoqueries", model) } just wondering if can convert model accept data model ipagedlist<centraladdrcdoquery> i.e. ipagedlist<t> , t can of of type centraladdrcdoquery,landbfsladdraddrcdoquery etc , can render relevant partial view checking viewbag value as have mentioned, bringing search results. although results might come dif

php - Woocommerce Gateway Integration Payment Status not updating -

i have set custom woocommerce off-side payment gateway, communication website gateway works fine. user gets redirected gateway , after payment gets returned (by woocommerce) defined return url. in api documentation of gateway, says payment gateway add query string variable return url. variable can have following values: response=approved response=declined response=error in documentation exampple: if backurl = http://www.test.com/return.asp response http://www.test.com/return.asp?response=approved to process order have created code below (first state of response=approved ) however, order status not updated, when test it. hope can point me in right direction find error. on top of gateway have extended query_vars with: function add_query_vars_filter( $vars ){ $vars[] = "response"; return $vars; } add_filter( 'query_vars', 'add_query_vars_filter' ); after sending user gateway have function handle , process query string in return url: funct

haskell - Struggling with Applicative parsing -

so i'm having go @ writing complex parser, using applicative (the parser in question doesn't implement monad @ all). for trivial parsers, quite easy. non-trivial ones... not much. applicative interface seems violently force write in point-free style. extremely difficult deal with. consider, example: call = n <- name char '(' trim <- sepby argument (char ',' >> trim) char ')' trim char '=' r <- result return $ call {name = n, args = as, result = r} now let's try write using applicative: call = (\ n _ _ _ _ _ _ r -> call {name = n, args = as, result = r}) <$> name <*> char '(' <*> trim <*> sepby argument (const const () <$> char ',' <*> trim) <*> char ')' <*> trim <*> char '=' <*> trim <*> result applicative has forced me put variable bindings far away actual parser is. (e.g.,

c++ - Purpose of rep stos assembly command in this code from Visual Studio -

this question has answer here: can me interpret simple disassembly windbg? 5 answers take @ following code: void f() { } i compiled in visual studio 2013, debug, 32-bit mode , looked @ dissassembly. void f() { 00304cb0 push ebp 00304cb1 mov ebp,esp 00304cb3 sub esp,0c0h 00304cb9 push ebx 00304cba push esi 00304cbb push edi 00304cbc lea edi,[ebp-0c0h] 00304cc2 mov ecx,30h 00304cc7 mov eax,0cccccccch 00304ccc rep stos dword ptr es:[edi] } 00304cce pop edi 00304ccf pop esi 00304cd0 pop ebx 00304cd1 mov esp,ebp 00304cd3 pop ebp 00304cd4 ret what purpose of rep stos instruction? i'm curious. the rep stos instruction writes value in eax starting @ address pointed edi (your local stack in cas

java - immutable class objects -

the first class immutable class , need make imm2 immutable class too, my question can use objects of imm class in imm2 class ?? final class imm{ private final int value; public imm(int value) { this.value = value; } public int getvalue() { return value; } } final class imm2{ imm value; // legal ??? public imm2(imm value) { this.value = value; } public imm getvalue() { return value; } // set value removed there problems here mean code correct now? } you can never extend final class , can make objects of them. extending example; class imm2 extends imm { } // illegal, imm final. creating new (instantiating); imm yourimm = new imm(1); // legal.

c++ - XWindow + OpenGL, cant compile files -

i want compile opengl + xwindow c++ program, getting errors: g++: fatal error: no input files compliation terminated. ./source/linux_opengl.c: line 10: //: catalogue ...typedef: command not found ...bool command not found ...xsetwindowattributes command not found ...syntax error near '}'. and on... this compile script: $(g++ -wall -pedantic -ansi) ./source/linux_opengl.cpp ./source/render.cpp -o linux_opengl -lx11 -lgl -lglu -lxxf86vm how can compile program? well i'd start not doing this: $(g++ -wall -pedantic -ansi) this telling shell: "interpret output of g++ -wall -pedantic -ansi script , execute it". this not want. use just g++ -wall -pedantic -ansi ./source/linux_opengl.cpp ./source/render.cpp -o linux_opengl -lx11 -lgl -lglu -lxxf86vm

c# - AxWindowsMediaPlayer control location/size -

i have axwindowsmediaplayer control on winform. everything works far. can't resize or move control. i initialize control this: mediaplayer = new axwmplib.axwindowsmediaplayer(); mediaplayer.createcontrol(); mediaplayer.enablecontextmenu = false; ((system.componentmodel.isupportinitialize)(mediaplayer)).begininit(); mediaplayer.name = "wmplayer"; mediaplayer.enabled = true; mediaplayer.dock = system.windows.forms.dockstyle.fill; mediaplayer.size = this.size; this.controls.add(mediaplayer); ((system.componentmodel.isupportinitialize)(mediaplayer)).endinit(); mediaplayer.uimode = "none"; mediaplayer.url = filename; mediaplayer.settings.setmode("loop", true); mediaplayer.ctlcontrols.play(); but size ist same. how can set size or bounds of controls? thanks help it better in designer, rather code. in code, set size of player control large form. //occupies form's available space mediaplayer.dock = system.windows.forms.dockstyl

sql - WHEN condition based on the current row value -

in select query, put condition in case value called isactive if current row's column type "adhoc" set value of isactive "n/a". select case type when 'scheduled' 'scheduled' when 'adhoc' 'adhoc' else 'unknown' end 'type', case isactive when (type) = 'adhoc' 'n/a' when 0 'stopped' when 1 'active' end 'status' mytable but getting error on line when (type) = 'adhoc' 'n/a' : incorrect syntax near '='. how can make decision based on condition on current row? your second case based on single column, trying put condition in when , not allowed: case isactive when (type) = 'adhoc' 'n/a' when 0 'stopped' when 1 'active' end 'status' i think meant (use cas

reactjs - How to deal with hierarchical data with Reflux stores? -

outline in app i'm using react , reflux , have hierarchical setup regards data. i'm trying break elements of app separate stores able hook events correctly , separate concerns. i have following data flow: workspaces -> placeholders -> elements in scenario, when workspace created default placeholder must in turn created reference (id) newly created workspace. same applies placeholder element relationship. sticking point the reflux way seems suggest placeholderstore listens triggers workspacestore, adding newly created id this.trigger() . reflux allows single event triggered stores; preventing external components being able discern create or update actions. means if 1 trigger in store sends id argument[0] , subsequent triggers should same (to remain consistent). problem components looking updates multiple workspaces (e.g. re-ordering / mass updates). undesirable solution i had thought add in concept of storeactions ; actions stores can create, othe

How to track all request and responses from android device? -

this question exact duplicate of: how track resonse packet coming android device? [closed] i trying track request , responses , android device fiddler doing. how can achieve programatically use of given below see response. log.v(); log.d(); log.i(); log.w(); log.e(); or system.out.println(responce); possible duplicate android log.v(), log.d(), log.i(), log.w(), log.e() - when use each one?

transparency - Transparent control or user control in vb.net -

Image
i trying make transparent control child controls visible , opaque. i have added panel control main form via code in form load event. in adding 5 buttons child controls like: panel.controls.add(). of these, have set backcolor=color.transparent. when run program, button background shows background of next button in panel. if open child form, can see labels on child form background of panel. i want make container panel control transparent, can see main form through it. how can achieved? when form loads, can see neighbor buttons behind actual buttons "perform check" label on child form opened right before taking picture. : "check cases , combinations" button on child form opened right before took picture. how can make transparent? why doesn't background of panel control refresh main form background? panel sort of "keeps" whatever happens on main form , shows background. i found out there issues setting controls transparent

How to custom Spring Batch DelimitedLineTokenizer -

i have 2 file types insert in database. format : aa;bb;cc , aa;bb;cc;dd;ee this flatfileitemreader : <bean name="readercontracttoaddintoprv" class="org.springframework.batch.item.file.flatfileitemreader"> <property name="comments" value="#" /> <property name="linestoskip" value="1" /> <property name="strict" value="false" /> <property name="linemapper"> <bean class="org.springframework.batch.item.file.mapping.defaultlinemapper"> <property name="fieldsetmapper"> <bean class="net.wl.batchs.fieldsetmapper.linetocreateintoprvfieldsetmapper" /> </property> <property name="linetokenizer"> <bean class="org.springframework.batch.item.file.transform.delimit

java - How to clear cache of other applications -

i'm trying clear cache of applications installed on phone. here code: public void clearapplicationdata() { file cache = getcachedir(); file parent1 = new file(cache.getparent()); file parent2 = new file(parent1.getparent()); if(parent2.exists()) { string[] children = parent2.list(); for(string s : children){ if(!s.equals("lib")){ deletedir(new file(parent2, s)); log.d("tag", "file /data/data/app_package/" + s +" deleted"); } } } } public static boolean deletedir(file dir) { log.d("tag", "deleting :" + dir.getpath()); if (dir != null && dir.isdirectory()) { string[] children = dir.list(); (int = 0; < children.length; i++) { boolean success = deletedir(new file(dir, children[i])); log.d("tag", "delete :" + success +" \n");

node.js - nodejs using pm2 and debug ,all the log output by the ‘debug’ module all to the stderr ,why? -

pm2 -version:0.12.1;debug -version:2.1.0 code: debug("send data client success! length " + buf.length+" bytes!"); pm2 logs: [1_control-15 (err)] tue, 16 dec 2014 12:36:50 gmt [1_control] client.ts send data client success! length 100 bytes! [1_control-15 (err)] tue, 16 dec 2014 12:36:50 gmt [1_control]n client.ts send data client success! length 135 bytes! please help. not sure if question still relevant, official documentation says, can override behavior this: var debug = require('debug'); var error = debug('app:error'); // default stderr used error('goes stderr!'); var log = debug('app:log'); // set namespace log via console.log log.log = console.log.bind(console); // don't forget bind console! log('goes stdout'); error('still goes stderr!'); // set output go via console.info // overrides per-namespace log settings debug.log = console.info.bind(console);

php - jquery validations are not working when i click on submit button -

i have written html form , jquery perform validations. when click submit button, nothing happening. can't understand going on, whether form linking jquery file or not. please check code , me. index.html <html> <head> <title>validation</title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/custom.js"></script> </head> <body> <form action="" method="post" id="reg_form"> <p>name:</p> <p><input id="name" name="name" type="text"></p> <p>what's name?</p> <p>email:</p> <p><input id="email" name="email" type="text"></p> <p>enter mail id</p> <p>password:</p> <p><input id="pass1" name="pass1" type="passwo

Calling C# program from another C# program -

this question has answer here: how start c# program c# program in same map? 3 answers i have 3 c# programs need executed in order(testcsharp1, testcsharp2 , testcsharp3).2nd program should executed after first completes , 3 should execute after 1 , 2 finish. how can this. right now, have them scheduled tasks , manually check if have finished , start others. use proccess class (documentation) start process inside program. here example documentation: using system; using system.diagnostics; using system.componentmodel; namespace myprocesssample { class myprocess { public static void main() { process myprocess = new process(); try { myprocess.startinfo.useshellexecute = false; // can start process, helloworld do-nothing example. myprocess.startinfo.f

java - Liblinear usage format -

i using .net implementation of liblinear in c# code following nuget package: https://www.nuget.org/packages/liblinear/ but in readme file of liblinear, format x is: struct problem describes problem: struct problem { int l, n; int *y; struct feature_node **x; double bias; }; `l` number of training data. if bias >= 0, assume 1 additional feature added end of each data instance. `n` number of feature (including bias feature if bias >= 0). `y` array containing target values. (integers in classification, real numbers in regression) , `x` array of pointers, each of points sparse representation (array of feature_node) of 1 training vector. example, if have following training data: label attr1 attr2 attr3 attr4 attr5 ----- ----- ----- ----- ----- ----- 1 0 0.1 0.2 0 0 2 0 0.1 0.3 -1.2 0 1 0.4 0 0 0