Posts

Showing posts from June, 2010

c++ - How to get all applications associated to a specific file extension in windows? -

i want list of applications associated specific file extension such '.txt'. there information storing in hkey_classes_root, don't want access directly. i think may have solution executable path , there default icons. help.

string - c programming: (scanf and gets) -

am aware difference between scanf() , gets() function scanf() continues read input string until encounters whitespace, whereas gets() continues read input string until encounters \n or eof(end of file). to see difference in action, tried writing example on own follows: #include <stdio.h> int main() { char a[20]; printf("enter string\n"); scanf("%s",&a); printf("the string %s\n",a); char b[20]; printf("enter string\n"); gets(b); printf("the string %s\n",b); return 0; } when variable given string "manchester united" input, output was: enter string manchester united string manchester enter string...

scheduler - C#)How can I schedule Quartz job to run at 5 minutes from now? -

i trying schedule quartz job run @ 5 minutes now. created trigger startat() function: startat(datetime().now.addminutes(5.0)) this doesn't seem work , couldn't find reference job scheduling without cron expression. is there way schedule job datetime in c# ?

Initiate a template iteration in Meteor -

rather loading new template, there way force meteor initiate iteration (using {{#each}}) of array in meteor? example, if user selects value in pull down selector, initiate meteor iterate through array within template populate multiple selector list rather load whole new template new selector list. let's within template: . . . <form class="input-field col s6 card-selector"> <select multiple"> <option value="" disabled selected>select students</option> {{#each studentlist1}} <option value= '{{fullname}}'>{{formatname fullname}} ({{level}}) {{roomwk1}}</option> {{/each}} </select> </form> . . . when user selects value in different selector in template: <select class="week-selector"> <option value="" disabled selected>week</option> <option value="week1">week 1...

whois - What is the expiration date of a domain? -

when whois records of domain, contains expiration date. wondering expiration date of domain? how date has been set? happen domain after gets expired? set date? network solutions provides breakdown of happens during expiration , deletion periods. in short, page: if expired domain name registration not renewed during grace period provided us, pursuant our service agreement, rather delete domain name registration, may, in our sole discretion, renew , transfer domain name registration network solutions or third party on customer’s behalf.

c# - Adding Complex Header From One Word Doc to Another -

i using addheaderfromto function https://msdn.microsoft.com/en-us/library/office/cc546917.aspx . issue it's not taking images or tables might found in header section of document. there way header other document? the vba script below should you. run word document. modify suit. sub editall() dim doc dim integer dim doctoopen filedialog set doctoopen = application.filedialog(msofiledialogfilepicker) doctoopen.show = 1 doctoopen.selecteditems.count 'open each document set doc = documents.open(filename:=doctoopen.selecteditems(i)) activedocument.sections(1) 'insert new headers call editheader end next end sub sub editheader() if activewindow.view.splitspecial <> wdpanenone activewindow.panes(2).close end if if activewindow.activepane.view.type = wdnormalview or activewindow. _ activepane.view.type = wdoutlineview activewindow.active...

sql - Can you reuse the alias of a derived table inside the query that makes up the derived table? -

i have seen few queries alias of derived table used in query makes derived table. can confirm if allowable or not? here sample query. pay attention how alias "st" used twice: select ft.thiscolumn, st.otherid firsttable ft inner join (select st.commonid,st.otherid,dateentered,dateexited,row_number() on (partition otherid order dateentered desc) strank secondtable st (@startdate between dateentered , dateexited) ) st on ft.commonid=st.commonid , st.strank=1 is ok use same alias "st" in these 2 different places? the st inside derived table accessible inside query , inside phases executed after clause, , ok not accessible in outside context. the second st alias whole derived table's results used in outer context , inside phases executed after clause , ok too. as know, first of outer query clause executed , cause derived table executed , after result(which relational) returned derived table st alias , participated...

nginx - Working with alias inside location -

so here's server block server { listen 80; server_name domain.tld; root /var/www/domain.tld/html; index index.php index.html index.htm; location / { } location /phpmyadmin { alias /var/www/phpmyadmin; } location /nginx_status { stub_status on; access_log off; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } } browsing http://domain.tld/index.php works fine problem im encountering browsing http://domain.tld/phpmyadmin/ . returns 404 yet folder /var/www/phpmyadmin exist on server. viewing /var/log/nginx/error.log, no error being logged there yet access logged in /var/log/nginx/access.log. problem here? the problem phpmyadmin php application , location ~ \.php$ block not point correc...

jscript - Ping error return always equals 0 -

having trouble getting code work. can run script (with changes) in vbscript , runs fine. cant version return ping error return value other 0. appreciated. this scanning list of remote machines checkboxes , returning checked values. want run ping verify remote machine there before continuing. error return of 0 queries useless. function statuschk3(){ var checkedvalue = null; var inputelements = document.getelementsbyname("comp"); for(var i=0; inputelements[i]; ++i){ if(inputelements[i].checked) {checkedvalue = inputelements[i].value; var wshshell = new activexobject("wscript.shell"); var status = wshshell.run ("ping -n 1 -a" + checkedvalue + ",0 ,true"); if(status == 0) { var fso = new activexobject("scripting.filesystemobject"); var s = fso.opentextfile("c:/script/testfile1.txt", 8, true); s.writeline(checkedvalue + " turned off or off domain"); s.close(); } els...

javascript - Button, when clicked, reloads the page instead of calling function -

i making calculator game , made button this: <button onclick="myfunction()">calculate</button> when button clicked, want run following myfunction() script: <script> function myfunction() { var currdura, maxdura, tempmaxdura, tempdura, totdura, optdura; var inicost, repcost; var smitheffi, smithcharge; var se, sc; var totcosttillnow, costperbattle = 0, mincpb; var i; var repcount = 1; //assigning values currdura=document.getelementbyid("currdura_").value; maxdura=document.getelementbyid("maxdura_").value; inicost=document.getelementbyid("inicost_").value; repcost=document.getelementbyid("repcost_").value; smitheffi=document.getelementbyid("smitheffi_").value; smithcharge=document.getelementbyid("smithcharge_").value; se = smitheffi / 100; sc = smithcharge / 100; tempmaxdura = maxdura; tempdura = currdura; totdura = tempdura; totcosttillnow = inicost; costperbattle = totcosttillnow / totdu...

javascript - convert array of numbers in array of strings using map -

im using lodash, , im trying convert array of numbers in strings, convert numbers since in array there null values. tried using map of lodash in map javascript messing null values. example of array: [1245, 5845, 4585, null, null] code: var meds = _.map(lines,'med_id').map(string); result: ["1245", "5845", "4585", "null", "null"]; should be: ["1245", "5845", "4585", null, null]; you need test type of value before calling string var meds = _.map(lines, 'med_id').map(function(x) { return typeof x == 'number' ? string(x) : x; });

virtual machine - Reset Gcloud Windows Instance Gateway or Network Configuration -

i made big mistake , changed gateway value in windows network configuration, cant connect windows server instance anymore. how can reset network configuration inside machine google console? save life i managed change network configuration using startup script. go server configuration, metadata , enter these values: for metadata variable: windows-startup-script-cmd for value: netsh interface ip set address "local area connection" dhcp reset server , reconfigure dhcp mode.

java - Invalid Content Was Found Starting With Element -

i have error writing xml , xsd. wrote students.xsd: <?xml version="1.0" encoding="utf-8" ?> <xs:schema attributeformdefault="unqualified" xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified"> <xs:element name="students"> <xs:complextype> <xs:sequence> <xs:element name="student"> <xs:complextype> <xs:sequence> <xs:element name="name"> <xs:complextype> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:...

html - CSS: Two Logos aligned to the left and to the right which should autoscale by window resize -

i have 2 logos on website should go on top of website. 1 logo should aligned left , second logo right. when browser window gets pushed smaller, space in between 2 logos should narrower , when 2 logos "hit" each other, both supposed scale smaller without breaking line. right left logo scales down , right logo breaks line , gets pushed lower without scaling down @ all. can me? my css: .image-wrapper { position: relative; white-space: nowrap; } .scale-image { display: block; width: auto; max-width: 55%; white-space: nowrap; } here html code: <div class="image-wrapper"> <a href="#" ><img src="http://www.drogies-test.de/wp-content/uploads/2016/05/logo_oskar.jpg" align="left" class="scale-image"/></a> <div /> <div class="image-wrapper"> <a href="#" target="_blank" ><img src="http://www.drogies-test.de/pics/logo_theater_os.gif...

python - Testing a POST that uses Flask-WTF validate_on_submit -

i stumped on testing post add category database i've used flask_wtf validation , csrf protection. crud operations pm website. i've used flask, flask_wtf , flask-sqlalchemy. first independent project, , find myself little @ lost on how test flask-wtform validate_on_submit function. here's models: class users(db.model): id = db.column(db.integer, primary_key=true, unique=true) name = db.column(db.string(80), nullable=false) email = db.column(db.string(250), unique=true) class category(db.model): id = db.column(db.integer, primary_key=true, unique=true) name = db.column(db.string(250), nullable=false, unique=true) users_id = db.column(db.integer, db.foreignkey('users.id')) here's form: class categoryform(form): name = stringfield( 'name', [validators.length(min=4, max=250, message="name problem")]) and here's controller: @category.route('/category/add', methods=['get', '...

java - How do I start one thread for my code and one for a JavaFX Application? -

i'm trying run program using javafx. if using swing, have 1 class started main method, , have build gui class. give me 2 threads, normal thread application, , eventqueue. prevent blocking ui work. so, tried have class created in static main method construct application class, , launch it. got runtimeexception because program calling launch method not subclass of application. is there way have separation of threads, or have work inside thread given application class? in javafx, i'm guessing in order prevent common threading errors present in many swing applications, startup process constrained (more or less) way things forces execute ui code on fx application thread: public class myappstartclass extends application { @override public void start(stage primarystage) { // method executed on fx application thread // load ui , display here.... } } in oracle jre, executing java myappstartclass (in contrast regular java application),...

Is it possible to add custom images to google analytics dashboard? -

let's have web site images. once user clicks on image track event image name action name. names not human readable converted working image urls. is there way create dashboard these images? i'd use native dimensions visualise these events. custom widget work here didn't find way create one. solution can see getting data api , visualising outside google analytics ui. you correct; you'd have take data , visualise elsewhere. native google analytics dashboarding tools extremely limited, , not capable of you're asking.

java - How to return a file with Google Cloud Endpoints? -

i have method generate csv file db records public static void generatecsvforattendees( list<attendee> attendeelist ) throws filenotfoundexception { printwriter pw = new printwriter(new file("test.csv")); stringbuilder sb = new stringbuilder(); //header sb.append( "id" ); sb.append( ',' ); sb.append( "name" ); sb.append( ',' ); sb.append( "lastname" ); sb.append('\n'); //content for( attendee attendee: attendeelist ) { sb.append( attendee.getid() ); sb.append( ',' ); sb.append( attendee.getuser().getname() ); sb.append( ',' ); sb.append( attendee.getuser().getlastname() ); sb.append( '\n' ); } pw.write(sb.tostring()); pw.close(); } i method endpoint in order invoke kind of client (...

c++ - Intermediate calculations inside initialization list -

i have like struct foo { const double a; const double b; foo(double c); } foo::foo(double c) { double tmp = f(c); = g(tmp); b = h(tmp); } where f,g,h functions implemented elsewhere. gives expected "uninitialized const member" error. i fix with foo::foo(double c): (g(f(c))), b (h(f(c))) {} but f expensive function , wouldn't run twice. my question is, how can solve problem without running f twice or making tmp permanent member of foo ? typically, delegating constructors offer simple solution type of problem. in case you'll have introduce way distinguish between 2 constructors: private: // int param unused foo(double fc, int) : a(g(fc)), b(h(fc)) {} public: foo(double c) : foo(f(c), 0) {}

IPFS add returns 2 jsons -

the add command returns 2 jsons - not yet sure if bug or feature not aware of: ⋊> ~ curl -f "image=@/home/ligi/bar" 127.0.0.1:5001/api/v0/add 00:53:12 {"name":"bar"} {"name":"bar","hash":"qmbfmke1kxqnyybbwxb74n4c5sbnjmvaimnrcgu6x1awqh"} unfortunately breaks ipfs-java-api a recent commit changed way progress flag handled in add, you'll have explicitly disable progress when making api calls add. i did in go-ipfs-api recently: https://github.com/ipfs/go-ipfs-api/commit/7c354892da3abdaafb6ac576c100b259b1a73dac

javascript - Gulp and Babel: Error: Cannot find module -

i have project i've set using gulp , babel . working fine, except when create module , import once it's converted es6 es6 doesn't work. error: error: cannot find module 'hello.js' @ function.module._resolvefilename (module.js:440:15) @ function.module._load (module.js:388:25) @ module.require (module.js:468:17) here's gulpfile.babel.js : import gulp "gulp"; import babel "gulp-babel" import concat "gulp-concat" const dirs = { src: "src", dest: "build" } gulp.task("build", () => { return gulp.src(dirs.src + "/**/*.js") .pipe(babel()) .pipe(concat("build.js")) .pipe(gulp.dest(dirs.dest)) }); gulp.task("default", ["build"]); during build concatenated 1 file. under src/ have: app.js hellojs app.js import hello './hello.js' console.log(hello()); hello.js export default () => { return 'h...

Loading XML with JQuery -

i'm working on dog web site xml back-end. <?xml version="1.0" encoding="utf-8"?> <breeder> <dog> <dogs_id>001</dogs_id> <dogs_image>../images/eclipse.jpg</dogs_image> <dogs_breeding_name>eclipse</dogs_breeding_name> <dogs_given_name>coco</dogs_given_name> <sex>female</sex> <dogs_mom>juno</dogs_mom> <dogs_dad>brutus</dogs_dad> <dogs_pedigree>../pedigrees/pedigree - kodiak.jpg</dogs_pedigree> <dogs_pedigree_status>active</dogs_pedigree_status> <alaa_registration>alaa - 000000</alaa_registration> <microchip_no>0000</microchip_no> <eye_colour>copper</eye_colour> <colour_genetics>bbee, kyky, ata, ssp</colour_genetics> <coat_colour>chocolate , tan phantom</coat_colour> <adult_height>16"</adult_height> <coat_type></coat_type> <adult_weight>20lbs...

Excel VBA - Nested loop to format excel table columns -

i have macro far, adds 4 new table columns existing table ("table1"). now, macro format 3rd , 4th row percentage. include in loop listed in code. have tried several different ways this. don't think quite understand how ubound function works, can understand trying do. i unsure if allowed continue utilize statement in nested loop in regards me 'lst' variable. @jeeped - i'm looking @ 1 again...thanks walking me through whole project lol sub attstatpivinserttablecolumns_2() dim lst listobject dim currentsht worksheet dim colnames variant, r1c1s variant dim h integer, integer set currentsht = activeworkbook.sheets("sheet1") set lst = activesheet.listobjects("table1") colnames = array("aht", "target aht", "transfers", "target transfers") r1c1s = array("=([@[inbound talk time (seconds)]]+[@[inbound hold time (seconds)]]+[@[inbound wrap time (seconds)]])/[@[calls handled]]", "=...

superclasses in generic classes in java -

this first time here, best describe problem: i have abstract class a . have abstract classes b , c extending a . have classes extending b or c . now have generic class accepting classes extending a . ( class xyz<abc extends a>… ) now want create method works generic class, instances use class extending b . i tried this: public void method(xyz<b> t){} this sadly didn't work. ide wanted me have either type of t or other way around. now questions: why not work? seems wouldn't cause problems, because subclass has provide methods superclass. there way around except of making method every single subclass of b or changing type of object want use? example code: public class main { public static void main(string[] args) { arraylist<abc> foo = new arraylist<>(); xyz(foo); } private void xyz(arraylist<b> abs){} private static abstract class a{} private static abstract class b extends a{} private static abstract class ...

Openshift - get domain name for MySQL database -

in env variable there host mysql database. ip in local network (starts 127...). how can make mysql available external world via domain name db? this not possible. openshift platform-as-a-service (paas) shields internals of implementation in paradigm allows access through api connector such php , database cartidge. or through ssh tunneling. not expose ip address of mysql server sitting there port 3306 use in development such db libraries c#, java, python, etc. or mysql workbench or like. in fact, not mysql server as shared one. infrastruture-as-a-service (iaas) platforms such aws ec2 allow native port 3306 connections , public ip address exposed if opened firewall them. with openshift, in order achieve connections such things mysql workbench, need pki key pair , ssh tunnel. same native app, say, written in c#, need likes of ssh.net . these configurations bearable single developer, don't scale rollout users, speaking. unless task of doing that. is, key management. ...

angularjs - Image Not Displayed in HTML -

the image not displayed below code. if can see //xyz.jpg?h=100&w=100 in browser. what might missing? <img class="item-thumbnail pointer" data-ng-if="!ispdf()" data-ng-class="{'pointer':showpointer()}" data-ng-src="//xyz.jpg?h=100&amp;w=100" alt="" src="xyz.jpg?h=100&amp;w=100"> data-ng-src="'xyz.jpg?h=100&amp;w=100'" (string url value) and src="xyz.jpg?h=100&amp;w=100" (url value) make sure image url yourdomain/xyz.jpg?h=100&amp;w=100 you should use src in case.

scala - @Inject object null: Play dependency injection -

i instantiated using dependency injection in controller class. when try use object using @inject annotation elsewhere, null value. here code skeleton. @singleton class serviceclient(ws: wsclient, config: configuration) { def response() {...} } class app @inject()(client: serviceclient) extends controller { def getitems = action { obj() } } case class obj() { @inject var client: serviceclient = _ def dostuff() { client.getresponse() //client null null pointer exception. .... } } the @inject in obj never seems working. , client object null. (i not want pass client param obj.) expectation serviceclient object created in controller should have been injected in obj(). did wrong? update injecting obj controller, not option. (in app obj instantiated @ run time complicated rule, using reflection).also dont want have constructor injection in obj. i looking field injection of serviceclient outside of controller. update2 i able solve problem usin...

php - skip duplicates and filter foreach -

i'm trying filter items in big .txt file show ones match current date. able show items matching current day, seems include items before , loops last entry endlessly. this file i'm working in: <?php include ($_server['document_root'].'/wp-load.php'); require_once('program.php'); date_default_timezone_set("europe/oslo"); $datetime_now = date('y-m-d h:i:s'); $idag = date('y-m-d'); $imorgen = date("y-m-d", strtotime("+1 day")); // $datetime_now = '2010-01-04 09:29:00'; $i = 0; // // echo "<pre>"; // print_r($program); // echo "</pre>"; $program = getradioprogram(); foreach ($program $program_na) { if ($idag == substr($program_na['datotid'], 0, 10)) { if ($i == 0) $j = 0; else $j = $i-1; // echo "i: ".$i." j: ".$j; $program_dato = substr($program[$j]['...

yodlee - IllegalArgumentValueException calling addSiteAccount1 -

i not having success getting addsiteaccount1 api work. using .net, don't believe has issue. seems missing in request, have read documentation , other posts, can't figure out might missing. here request (captured fiddler): cobsessiontoken <<removed>> usersessiontoken <<removed>> siteid 2852 credentialfields[1].valuemask login_field credentialfields[1].valueidentifier password credentialfields[1].value <<removed>> credentialfields[1].size 20 credentialfields[1].name password credentialfields[1].maxlength 20 credentialfields[1].isoptionalmfa false credentialfields[1].isoptional false credentialfields[1].ismfa false credentialfields[1].isescaped false credentialfields[1].iseditable true credentialfields[1].helptext 5372 credentialfields[1].fieldtype.typename if_password credentialfields[1].fieldinfotype com.yodlee.common.fieldinfosingle credentialfields[1].displayname passcode credentialfields[0].valuemask ...

android - Can not initialize Facebook SDK in air + ane -

protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.v("ane", "oncreate"); facebooksdk.sdkinitialize(getapplicationcontext()); log.v("ane", "init fb"); //setcontentview(resources.getresourseidbyname("com.yoonsik.facebookane", "layout", "activity_main")); setcontentview(r.layout.activity_main); log.v("ane", "setcontentview"); callbackmanager = callbackmanager.factory.create(); i'm trying initialize facebook sdk this, not working. fine in eclipse java project never works in app. sure set key hashes in facebook developer page , .ane file fine. <android> <manifestadditions><![cdata[ <manifest android:installlocation="auto"> <!--see adobe air documentation more information setting google android permissions--> <!--removing permis...

c++ - How to load the image with caffe? -

i'm writing code machine learning program using caffe-windows. want load image file. but, don't know convert image leveldb. can not load image? mean, want image load. not leveldb data. i'm using caffe-windows , visual studio 2013. thank you. converting images db(leveldb/lmdb) files can speed training because can reduce time needed network read images disk. if still not want to, can use layer type " imagedata " instead of "data" in prototxt , set its' param image_data_param { source: "path/to/your/images/list.txt" } every line in list.txt provides path of image , its' label.

arrays - Java: Assign values to alphabet and determine value of a string -

so trying solve problem in java below. give me idea of how approach this? can think of using bunch of confusing for-loops split arr, go through alphabet, , go through each string, , confused strings versus chars. advice great. -- suppose letter 'a' worth 1, 'b' worth 2, , forth, 'z' worth 26. value of word sum of letter values in it. given array arr of words composed of capital letters, return value of watch largest value. may assume arr has length @ least 1. {"aaa","bbb","ccc"} => 9 {"aaaa","b","c"} => 4 {"z"} => 26 {"",""} => 0 -- here have tried far i'm lost: public static int largestvalue(string[] arr){ string alphabet = "abcdefghijklmnopqrstuvwxyz"; int largest = 0; int wordtotal=0; (int = 0; < arr.length; i++){ string[] parts = arr[i].split(""); if (wordtotal < largest){...

sql - Limit a sorted number of rows joined -

i have 2 tables, , b, , join table m. want to, each a.id, top 2 b.id's sorting on value in table m, producing results below. running on azure sql database table table m table b +-----+ +-----+-----+-------+ +-----+ | id | | aid | bid | value | | id | +-----+ +-----+-----+-------+ +-----+ | 1 | | 1 | 3 | 4 | | 1 | | 2 | | 1 | 2 | 3 | | 2 | | 3 | | 3 | 2 | 3 | | 3 | | 4 | | 3 | 5 | 6 | | 4 | +-----+ | 3 | 3 | 4 | | 5 | | 4 | 1 | 2 | +-----+ | 4 | 2 | 1 | | 4 | 4 | 3 | +-----+-----+-------+ result +-----+-----+-------+ | aid | bid | value | +-----+-----+-------+ | 1 | 3 | 4 | | 1 | 2 | 3 | | 3 | 5 | 6 | | 3 | 3 | 4 | | 4 | 1 | 2 | | 4 | 4 | 3 | ...

c++ - delete right child makes parent left pointer point to nullptr -

thank checking question, have basic question on operator "delete", seems can automatically change pointer value nullptr. let me give example this: template <typename t> void tree<t>::remove(const unsigned& index, treenode<t>*& tree) { if(tree == nullptr) { std::cerr << "remove: can't find target" << std::endl; } else if(index < tree->index) { remove(index, tree->left); } else if(index > tree->index) { remove(index, tree->right); } else if(index == tree->index) { if(tree->degree() == 2) { tree->index = findmin(tree->right)->index; tree->value = findmin(tree->right)->value; remove(tree->index, tree->right); } else { au...

c# - Fody - method caching -

i using fody method cache ( https://github.com/dresel/methodcache ) first time. doing wrong because following code not work: static void main() { console.writeline("begin calc 1..."); var v = calc(5); console.writeline("begin calc 2..."); //it last same first function call v = calc(5); console.writeline("end calc 2..."); } [cache] static int calc(int b) { thread.sleep(5000); return b + 5; } what should use following: first call: cache arguments keys , return value value. other call: if cache[arg1, arg2,...] exist return cache value without completing function ? (using cache attribute) as stated in github issue, static method caching added in 1.3.1. as methodcache.fody designed, have add cache getter class contains methods should cached , implement cache. can program own cache or use adapter existing cache solutions (see documentation of https://github.com/dresel/methodcache ). the minimum code sample (with basic...