Posts

Showing posts from August, 2010

c++ - Cast DWORD_PTR to class and vice versa without c-style cast -

according herb sutter's c++ coding standards: 101 rules, guidelines, , best practices programmer should avoid c-style casting: c-style casts have different (and dangerous) semantics depending on context, disguised behind single syntax. replacing c-style casts c++-style casts helps guard against unexpected errors i trying pass pointer p_ctrl winapi callback function, want use dword_ptr parameter of callback function (below example working, contains c-style casts commented): wndctrls* wndctrls::button ( wndctrls* const p_ctrl, hwnd hwnd, rect const &rc ) { p_ctrl->ctrl = createwindowex ( 0, l"button", p_ctrl->w_classnamebutton.c_str (), ws_visible | ws_child | bs_ownerdraw, rc.left, rc.top, rc.right, rc.bottom, hwnd, 0, (hinstance)getwindowlongptr ( hwnd, gwl_hinstance ), // problematic c-style cast know workaround p_ctrl ); setwindowsubclass...

Python Cookielib with HTTP Servers that Have Incorrect Date / Timezone Set -

Image
i using python , cookielib talk http server has date incorrectly set. have no control on server, fixing time not possibility. unfortunately, server's incorrect time messes cookielib because cookies appear expired. interestingly, if go same website web browser, browser accepts cookie , gets saved. assume modern webbrowsers come across misconfigured web servers time , see date header set incorrectly, , adjust cookie expiration dates accordingly. has come across problem before? there way of handling within python? i hacked solution includes live-monkey patching of urllib library. not ideal, if others find better way, please let me know: cook_proc = urllib2.httpcookieprocessor(cookielib.lwpcookiejar()) cookie_processing_lock = threading.lock() def _process_cookies(request, response): '''process cookies, in way can handle servers bad clocks set.''' # real monkey hacking here, put in lock. cookie_processing_lock: #...

php - PayPal send and retrieve custom GET parameter -

my customers can pay via paypal link this: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=gksjena5fsksw is there way append parameter , later retrieve it? actually know that user payed don't know who payed. i'm storing user data before redirect paypal , give id. there way send id paypal , retrieve maybe parameter @ page paypal redirects when payment completed?

logical - Prolog - intern variables sum -

i'm having trouble trying sum lists have. i'm having: [[[_g8511,0,1,_g8520],[_g8526,1,0,0],[_g8541,_g8544,0,1]], [[1,1,1,_g8568],[0,1,0,1],[0,_g8592,0,1]], [[1,0,_g8613,_g8616],[0,1,_g8628,0],[0,_g8640,_g8643,1]]] my problem try sum elements inside list. know how iterate through it, need either ignore intern variables, or make them 0. i tried using sum_list(list, sum), figured can not handle intern variables. question how can either ignore elements not having value of 0 or 1, or how can make internal variables 0? you use nonvar/1 predicate succeeds when argument not variable. you write sum_list predicate: sum_list(list,sum):-flatten(list,list2),sum_list2(list2,sum). sum_list2([],0). sum_list2([h|t],sum):- var(h),sum_list2(t,sum). sum_list2([h|t],sum):- nonvar(h), sum_list2(t,sum1),sum sum1+h. note in above solution since need sum , lists nested used flatten/2 predicate flatten nested list flat list. ?- sum_list([[[_g8511,0,1,_g8520],[_g8526,1,...

java - Android ListView with button -

so making app have list of items contains text , button besides it. i getting error in custom adapter class: java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.button.setonclicklistener(android.view.view$onclicklistener)' on null object reference the entire custom adapter class follows: package com.android.ict.seneca.androidpocketguide; import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.button; import android.widget.imageview; import android.widget.textview; import android.widget.toast; import java.util.list; public class customlistadapter extends arrayadapter<rowitem> { private context context; public customlistadapter(context context, int resourceid, list<rowitem> items ) { super( co...

python - How to pass values to a trained Regressor Function from a Javascript front end? -

i trained sgdregressor on dataset 3756 rows. returned alpha value want use. want output prediction based on new set of values received javascript front end. includes categorical data need 1 hot encoding. want know how pass values trained regressor module , generate prediction based on it. def rmse_cv(model): rmse = np.sqrt(-cross_val_score(model, x_train, y, scoring="neg_mean_squared_error", cv=5)) return(rmse) alphas = [0.00005, 0.00015, 0.00045, 0.0135] mv_sgd = [rmse_cv(sgdregressor(alpha = alpha)).mean() alpha in alphas] typically use .fit() , .predict() methods, assuming you're using sklearn. create predictor object this: from sklearn import linear_model clf = linear_model.sgdregressor() clf.fit(x, y) then when new value, javascript, use predict.method prediction = clf.predict(newcase) there many ways value javascript, mentioned, django may start.

debugging - React-native run-android DeviceException: Failed to establish session -

this error message received when ran react-native run-android com.android.builder.testing.api.deviceexception: com.android.ddmlib.installexception: failed establish session my avd android-23 x86_64 emulator have working. haven't yet connected app's apk nor know how connect emulator.

c - Update global variable from inside switch -

perhaps question obvious answer, i'm new c , have spent hours trying work myself , searching on site. i'm building simple program starts variable holds number (1234 in case), , 1 of options in program allows user change variable (value). so, user asked enter new number value hold. asked same numbers again. if numbers entered same, value should updated hold these new numbers (stored in both newvalue , newvaluecheck ). i'm trying figure out how update value assigning numbers stored in new variables no matter try, when menu loops around , ask program numbers in value , it's stuck 1234. again, sorry if obvious, it's driving me insane. int x = 1; int value = 1234; int enteredvalue = 0; int newvalue = 0; int newvaluecheck = 0; while (x != 0) { printf("1. example"); printf("2. change value"); scanf("%d", &atm); switch (x) { case 1: //code here break; case 2: printf(...

javascript - Can't display a component in AngularJS -

i building small cinema website. issue have list, when click listen button displayed function, when click function should give more details on item have clicked. have tried work through angular tour of heroes again can't details show up. https://i.imgur.com/mzucalv.png the above seen, details should shown on page there no error relevant why not showing. `import { ngmodule } '@angular/core'; import { browsermodule } '@angular/platform-browser'; import { formsmodule } '@angular/forms'; import { appcomponent } './app.component'; import { dashboardcomponent } './dashboard.component'; import { herodetailcomponent } './hero-detail.component'; import { heroescomponent } './heroes.component'; import { heroservice } './hero.service'; import { accordionmodule } 'primeng/primeng'; import { approutingmodule } './app-routing.module'; import { ratingmodule} 'primen...

c - Printing elements of a char array with numbes and letters -

i trying print out elements of char array consists of both numbers , letters. code is: char *receiveinput(char *s) { scanf("%99s", s); return s; } int main() { char str[100], inp[50] = ""; printf("enter string"); receiveinput(str); char ctostr[3]; int num = 3; char c = (char)(num); ctostr[0] = c; ctostr[1] = str[0]; ctostr[2] = '\0'; strcat(inp, ctostr); printf("%s\n", inp); return 0; } lets str in "hey" , inp should contain , print "3h " instead prints 'h' when ctostr[0] = c (which char 3). how print elements contain both numbers , letters? number 3 not same character '3'. example in ascii table character '3' has integer code in hex 0x33 while in ebcdic table has code 0xf3 . you can write int num = 3; char c = num + '0'; ctostr[0] = c; provided num less 10.

angular - Bootstrap DropDown and collapse dont work with angular2-meteor -

i install bootstrap in angular2-meteor project with: meteor npm install --save bootstrap@4.0.0-alpha.5 then dropdown , collapse component dont work, when add bootstrap scripts lines in index.html body bootstrap component work fine. why if plan use bootstrap 4 css angular 2 suggest evaluating 1 of libraries provide native bootstrap widgets: https://ng-bootstrap.github.io those widgets written angular 2 , offer apis make sense in context of angular 2. since library written ground-up angular 2 won't need dependency on jquery nor bootstrap's javascript (it enough include bootstrap's css , mentioned library)

javascript - Materialize CSS - passing data to sideNav -

i'm using materializecss latest project , have problem. i use sidenav open 'modal' inside of contact form. this contact form should used in multiple occasions , different informations should prefilled depending on button user click. let me explain in example: if user clicks on send message forms input title should like <input type='text' id='title' name='title' readonly value="general message"> and if user clicks on button request candy input should like <input type='text' id='title' name='title' readonly value="i want candies!"> since sidenav opens clicking on element of type <a href="#" data-activates="slide-out" class="button-collapse"><i class="material-icons">menu</i></a> i had idea react on click as $(document).on('click', '.button-collapse', function() { console.log('got ...

github - Git - push to remote repository failed -

ok, im new git , have isue can't solve myself, after couple of hours spended here , there on reading topics similar question. try describe in details: name of github repo rep_1 in rep_1 there 5 folders (1,2,...,5), , there index.html in each. made new folder 'work' , git clone <url> forked repo. in folder 1/index.html used git init , git add . , git commit -m make changes. then used git remote add 1 https://github.com/username/rep1 after that, git push 1 and got: fatal: current branch master has no upstream branch. push current branch , set remote upstream, use git push --set-upstream 1 master i used didn't help. got time: fatal: current branch master has no upstream branch. push current branch , set remote upstream, use git push --set-upstream work master also dind't work. repository not found i've tried git push -u rep_1 , got same errors. have no ideas should do. in rep_1 there 5 folders ...

Rails: collecting records from grandparent's attributes -

i've got deep-nested relationship so: >> @document.template_variables.first.master.box.stack => #<stack id: 6, name: "contact information", direction: "down", x: 145.0, y: 145.0, template_id: 28, width: 55, page: 1, html_box: "column_right"> master isn't quite normal rails relationship, , it's defined in templatevariable so: def master templatevariable.find(master_id) if master_id.present? end so it's kinda referring instance of itself, can see log output on top works fine. my issue need all templatevariables parent stack matches box name so: scope :by_box, -> (b) { where('box.stack.html_box' => b) } but no matter try, in console, can't query right. >> @document.template_variables.where(master.box.stack.html_box != nil) !! #<nameerror: undefined local variable or method `master' #<#<class:0x007fd287cd9888>:0x007fd28bb11ee8>> and scope returns error: ...

linux - Using printf in assembly leads to an empty ouput -

i try use printf assembler code, minimal example should print hello stdout: .section .rodata hello: .ascii "hello\n\0" .section .text .globl _start _start: movq $hello, %rdi #first parameter xorl %eax, %eax #0 - number of used vector registers call printf #exit movq $60, %rax movq $0, %rdi syscall i build with gcc -nostdlib try_printf.s -o try_printf -lc and when run it, seems work: string hello printed out , exit status 0 : xxx$ ./try_printf hello xxx$ echo $? 0 xxx$ but when try capture text, obvious, not working properly: xxx$ output=$(./try_printf) xxx$ echo $output xxx$ the variable output should have value hello , empty. what wrong usage of printf ? as michael explained, ok link c-library dynamically. how introduced in "programming bottom up" book (see chapter 8). however important call exit c-library in order end program , not bypass it, wrongly did calling exit-sys...

position - CSS: Footer crashing into content area -

i've been trying solve using sorts of methods, including display, clear, float , position , nothing seems change this. basically happening footer on homepage ( http://writtenpalette.com/ ) crashing #content div. seems respecting #sidebar height instead of entire content height. like said i've tried sorts of methods....none of seemed have worked. here's css main sections see might issue: body.home #content { visibility: hidden; float: left; width: 70%; margin-left: -3%; } .sidebar { float: right; width: 300px; } #footer { position: relative; clear: both; width: 100%; background: #65254a; color: #fff; padding: 10px 16px; } replace <div id="content" class="hfeed masonry" style="position: relative; height: 0px;"> to <div id="content" class="hfeed masonry" style="position: relative; height: auto;">

big o - Time complexity(Java, Quicksort) -

Image
i have general question calculating time complexity(big o notation). when people worst time complexity quicksort o(n^2) (picking first element of array pivot every time, , array inversely sorted), operation account o(n^2)? people count comparisons made if/else statements? or count total number of swaps makes? how know "steps" count calculate big o notation. i know basic question i've read articles on google still haven't figured out worst cases of quick sort worst case of quick sort when array inversely sorted, sorted , elements equal. understand big-oh having said that, let first understand big-oh of means. when have , asymptotic upper bound, use o-notation. given function g(n), denote o(g(n)) set of functions, o(g(n)) = { f(n) : there exist positive c , n o , such 0<= f(n) <= cg(n) n >= n o } how calculate big-oh? big-oh means how program's complexity increases input size. here code: import java.util.*; class quickso...

python - Print only specific part of email -

i have code (below) shows me emails in email account. shows whole email, including metadata (which dont want). there way print to, from, subject , message only? in python well. thanks. code: import getpass, imaplib import os email = raw_input('email: ') password = getpass.getpass() m = imaplib.imap4_ssl("imap.gmail.com", 993) print('logging in ' + email + '...') m.login(email, password) m.select() typ, data = m.search(none, 'all') num in data[0].split(): typ, data = m.fetch(num, '(rfc822)') print ('message %s\n%s\n' % (num, data[0][1])) m.close() m.logout() you can use email.parser.parser() standard module parse mail , headers from __future__ import print_function import imaplib import getpass import os email.parser import parser email = raw_input('email: ') password = getpass.getpass() print('logging in as', email, '...') m = imaplib.imap4_ssl("imap.gmail.com", ...

c++ - Assign struct member from loop? -

i have struct data type struct column { int member1; int member2; }; and have loop counter=1; for(counter; counter <= input_column; counter++) { printf("%d", counter); } how assign every loop counter member of struct column ? example : if user inputs 5, struct column members should become this: struct column { int member1; int member2; int member3; int member4; int member5; }; thank in advance :) the short answer can't. struct type, size, variables, , methods know , set @ compile time. however, can use array or std::vector<t> store multiple values.

How can I make the same function execute with javascript promises? -

i want execute same function 3 times using javascript promises. each time function called text file read line line , answer each line written text file. want javascript promise wait till previous function done, reason runs 3 functions @ once, thereby writing 3 files @ once. since i'm processing massive file, writing 3 text files @ once takes long time. can please me figure out how run correctly? i'm new promises, , need can get. here code: function verifytransactions(filename,functionname,obj,depth){ var rd = readline.createinterface({ input: fs.createreadstream('../paymo_input/stream_payment.csv'), output: process.stdout, terminal: false }); rd.on('line', function(line) { var userdata = extractuserdata(line) if (userdata !== undefined){ var id1 = userdata[0], id2 = userdata[1]; if (obj[id1]){ console.log(id1) fs.appendfilesync('../paymo_output/'+filename +'.t...

Getting <<loop>> Exception in Haskell Depending on Pattern Arrangement -

someone can please explain why getting loop in code? module main import data.list.split import data.maybe import text.read main :: io () main = print (snd (toinmetdate "01/02/2012")) type p = (bool, a) readp :: (read a) => string -> p readp text | isjust value = (true, fromjust value) | isnothing value = (false, read "0") value = readmaybe text data inmetdate = inmetdate {dia :: p int, mes :: p int, ano :: p integer} deriving (show, read) toinmetdate :: string -> p inmetdate toinmetdate x = if length l == 3 (true, inmetdate (readp ds) (readp ms) (readp as)) else (false, inmetdate (false, 0) (false, 0) (false, 0)) (l,ds:ms:as:_) = (spliton "/" x, l ++ replicate 20 "null") i state that, when make: (l,ds:ms:as:_) = (spliton "/" x, l ++ replicate 20 "null") equal to: (ds:ms:as:_) = l ++ replicate 20 "null" l = spliton "/" x the code work perfectly. ...

python - Difference between LinearRegression() and Ridge(alpha=0) -

Image
the tikhonov (ridge) cost becomes equivalent least squares cost when alpha parameter approaches zero. on scikit-learn docs subject indicates same. therefore expected sklearn.linear_model.ridge(alpha=1e-100).fit(data, target) to equivalent to sklearn.linear_model.linearregression().fit(data, target) but that's not case. why? updated code: import pandas pd sklearn.linear_model import ridge, linearregression sklearn.preprocessing import polynomialfeatures import matplotlib.pyplot plt %matplotlib inline dataset = pd.read_csv('house_price_data.csv') x = dataset['sqft_living'].reshape(-1, 1) y = dataset['price'].reshape(-1, 1) polyx = polynomialfeatures(degree=15).fit_transform(x) model1 = linearregression().fit(polyx, y) model2 = ridge(alpha=1e-100).fit(polyx, y) plt.plot(x, y,'.', x, model1.predict(polyx),'g-', x, model2.predict(polyx),'r-') note: plot looks same alpha=1e-8 or alpha=1e-100 ...

recursion - Why does object not delete itself but continue rendering (Java) -

Image
the question have why recursive laser beam, speak, rendering kind of trail. idea behind class create laser making multiple copies of itself, , each time checking whether or not has reached end of screen or had hit object. supposed delete once update cycle rolls around, , since update called before render, should delete leaving smooth laser. laser leaving trail when moving it, not smooth if parts of previous update still there , not removed. included images when paddle still(what it's supposed like), when paddle moving(the laser leaving trail.) included handler class updates first, renders, pointer class. pictures: how supposed (paddle still) how looks (paddle moving) pointer class: public class pointer extends gameobject{ private gameobject p1, p2; private handler handler; private boolean more; public pointer(int x, int y, id id, handler handler) { super(x, y, id); p1 = handler.object.get(0); p2 = handler.object.get(1); ...

c++ - pointer segfault vs undefined behavior -

why code produce segfault when running regularly, undefined behavior instead of segfault if either add command line argument or comment out calling cpy function? #include <cstdlib> #include <iostream> #include <cstring> using namespace std; int *p; void fn() { int n[1]; n[0]=99; p = n; } void cpy(char *v) { char x[8]; strncpy(x,v,8); } int main(int argc, char** argv) { fn(); cpy(argv[1]); cout << "p[0]:" << p[0]; } i know n local var function fn , there way can overflow buffer or enter argv[1] print value n held wherever is/was in memory? if don't pass argument, argv[1]==nullptr . cpy(argv[1]) cpy(nullptr) , cpy invokes strncpy(x,nullptr,8) , segfaults. if comment out cpy, no segfault. if pass argument, cpy won't segfault. different problem: fn did p=n n declared on stack, , in main @ cout<<p[0] , p points @ object n no longer exists, , behavior undefined.

web scraping - Scrape an HTML page after AJAX calls for elements not in the page source -

i'm trying scrape webpage content want loads after dom completes. new content fetched through ajax calls. so fetched content isn't available in page source. can see when inspecting page. when use curl doesn't find elements on page. best method content? i'm trying use phantomjs this, i'm not sure if can either. thanks.

Can't connect to local MySQL server in R -

i learning how use mysql in r package rmysql: https://www.tutorialspoint.com/r/r_database.htm but when try connect db provided in example mysqlconnection = dbconnect(mysql(), user = 'root', password = '', dbname = 'sakila', host = 'localhost') i get: failed connect database: error: can't connect local mysql server through socket '/tmp/mysql.sock' (2) my guess running on laptop (mac os), if guess right (?) need virtual server. do know r package so? suggestion appreciated. first check sql service running. service mysqld start then try mysql -u root if not solve issue above solution try host = '127.0.0.1' instead of localhost. because 127.0.0.1 use tcp/ip connector. unless localhost run socket connector.

python - %matplotlib qt does not work -

python 2.7.12 |anaconda 4.2.0 (64-bit)| spyder 3.0.1| ipython 5.1.0 (running on windows) when asking plots in new window via: %matplotlib qt i error: traceback (most recent call last): file "<ipython-input-2-6ad73d0e50c7>", line 1, in <module> get_ipython().magic(u'matplotlib qt') file "c:\anaconda2\lib\site-packages\ipython\core\interactiveshell.py", line 2158, in magic return self.run_line_magic(magic_name, magic_arg_s) file "c:\anaconda2\lib\site-packages\ipython\core\interactiveshell.py", line 2079, in run_line_magic result = fn(*args,**kwargs) file "<decorator-gen-105>", line 2, in matplotlib file "c:\anaconda2\lib\site-packages\ipython\core\magic.py", line 188, in <lambda> call = lambda f, *a, **k: f(*a, **k) file "c:\anaconda2\lib\site-packages\ipython\core\magics\pylab.py", line 100, in matplotlib gui, backend = self.shell.enable_matplot...

Scope variable in java -

i have code, need find scope variable @ piratical point have commented. have doubt does args comes under scope variable? here code: public class helloworld { public static int foo(int num) { int other_num = 2; // num , other_num return num % other_num; } public static void main(string[] args) { int odd = 0; int x = 13; (int value = 0; value < x; value++) { // value , odd , x boolean local_odd = false; int r = foo(value); if (r == 1) { // value , odd , x , local_odd, r local_odd = true; } else { int div = value/2; system.out.println(div +" divides "+ value); // value , odd , x , local_odd, r , div } if (local_odd) { odd++; } } system.out.println(odd+" odd numbers smaller "+x); // odd , x } } the...

visual studio 2015 - VS2015 brace match colors within a string -

Image
in vs2015, when editing azure arm template (json), there subtle background applied matched braces within string. using photoshop i've been able identify color rgb(244,244,244) #f4f4f4 seen in image below. this color way subtle eyes , i'd change it, can't work out of 79,428 color attributes change in vs fonts & colors options list. does know fonts & colors option controls backgroun color? as turns out, setting needed brace matching , brace matching (rectangle) - editors (e.g. c#) sufficient close tab , re-open new colouring, while in json case needed shut down visual studio altogether. leaving here posterity.

Nginx how to redirect from https to http when not support https anymore -

my site https, , removed certificates because don't need https anymore. need way redirect visitors http version because maybe have domain bookmarked https version. tried this: server { listen 443; server_name example.com; ssl on; rewrite ^ http://$server_name$request_uri? permanent; } but when trying go https://example.com it's stuck. doing wrong?

schedule reports in Crystal Server -

i’ve downloaded , installed both crystal report 2016 & crystal server 2016 solution free trials. after configure job server – schedule sending report email (on cms console), unfortunately not email crystal server when set schedule. whereas status of due scheduled report ‘success’, right click on due file , send direct email, work!. whether related using trials version or what?

The connection between NP and Decision Pro -

state t/f. if proves p = np, imply every decision problem can solved in polynomial time. think false. right? if p = np , means decision problem in np can solved in polynomial time. is, decision problem "yes" answers verified efficiently solved in polynomial time. this not same saying decision problems can solved in polynomial time. example, decision problems (such halting problem) undecidable, meaning can't decided @ all. proving p = np doesn't change that.

angular - Object change detection in array -

i need manually (or automatically) change detect property of object in array. have array of productshops entity in ngfor loop filtered "isnotdeleted" property. when change value of isnotdeleted property angular not detect change. <ul class="nav nav-tabs"> <li *ngfor="let productshop of product.productshops | filter:'isnotdeleted':true" > <a href="#categoryassoctab{{productshop.shop.id}}" data-toggle="tab">{{productshop.shop.name}}</a> </li> </ul> edit: pipe implementation: import {pipe, pipetransform} "@angular/core"; @pipe({ name: 'filter' }) export class filterpipe implements pipetransform{ transform(value:array<any>, property, equal){ let properties = property.split('.') if(value){ return value.filter(item => { let finalvalue:any = item properties.foreach(p ...

php - How to insert data in the database in Symfony 3 issue -

i having problems understanding workflow how insert data in table. have simple contact form: this form: {{ form_start(form, { 'attr': {'id': 'contact-form'}, 'action': path('contact'), 'method': 'post'} ) }} <div class="text-fields"> <div class="float-input"> <input name="name" id="name" placeholder="name" type="text"> <span><i class="fa fa-user"></i></span> </div> <div class="float-input"> <input name="mail" id="mail" placeholder="e-mail" type="text"> ...

c# - Create Shortcut on desktop that calls PowerShell cmdlet -

i' trying create shortcut on desktop c# code, that opens powershell, imports mymodule.dll , clears screen, shows cmdlets of mymodule.dll . after executing c#, shortcut appears on dektop, reason quotes set around whole shortcut.targetpath . after removing quotes manually, fine. how prevent these quotes set? my code: object shdesktop = (object)"desktop"; wshshell shell = new wshshell(); string shortcutaddress = (string)shell.specialfolders.item(ref shdesktop) + @"\´mymodule.lnk"; iwshshortcut shortcut = (iwshshortcut)shell.createshortcut(shortcutaddress); shortcut.description = "mymodule"; shortcut.targetpath = @"%windir%\\system32\\windowspowershell\\v1.0\\powershell.exe -noexit -command &{ import-module \\srv\ps\mymodule.dll;clear; get-command -module mymodule}"; shortcut.save(); as commented petseral , use arguments property pass arguments executable: shortcut.targetpath = @"%windir%\\system32\\windows...

Bootstrap columns stack vertically when their total columns is equal to 12 -

in offsetting columns example this page first column has col-sm-5 , second column has same col-sm-5 offset col-sm-offset-2 . total of bootstrap grid's columns 5+(5+2)=12 suppoed make aligned horizontally small screens , not being stacked vertically result shows. why happen ? tried remove offset nothing has changed. <div class="container-fluid"> <h1>hello world!</h1> <p>resize browser window see effect.</p> <div class="row" style="background-color:lavender;"> <div class="col-sm-5 col-md-6" style="background-color:lightgray;">.col-sm-5 .col-md-6</div> <div class="col-sm-5 col-sm-offset-2 col-md-6 col-md-offset-0" style="background-color:lightcyan;">.col-sm-5 .col-sm-offset-2 .col-md-6 .col-md-offset-0</div> </div> </div> it seems working expected me, trying target smallest screens? if so, try -xs- instead of -...

c# - Generating SHA256 in Swift (iOS) -

i trying generate sha256 using following function:- func generatehmac(key: string, data: string) -> string { let keydata = key.datafromhexadecimalstring()! nsdata let datain = data.datausingencoding(nsutf16stringencoding) var result: [cunsignedchar] result = array(count: int(cc_sha256_digest_length), repeatedvalue: 0) cchmac(cchmacalgorithm(kcchmacalgsha256), keydata.bytes, keydata.length, datain!.bytes, datain!.length, &result) let hash = nsmutablestring() val in result { hash.appendformat("%02hhx", val) } return hash string } input is accountnumber: 100195 amount: 10 billerid: 59 channelid: 2 context: 11|test countryid: 1 customerid: 34 emailid: ankur.arya@me.com returnurl: https://uat.myfatoora.com/receiptpoc.aspx securitytoken: 6b4a47a6-40a0-4c9d-a925-5ceca2910881 txnrefnum: 991107844408242 username: usp and output 4cd1acc736a9702c8cdb1a546d1c274a67cb285dbdbb972aab39ee51c2a2‌​26c8 however, doesn’...

VBA Form dynamic hyperlink from current record -

i have search form. if double click on of items, new form opens selected record, can see details it. store id, can use open webpage https://mywebpage.net/asd/id . want concatenate base url ( https://mywebpage.net/asd/ ) id, doesn't work. tried "https://mywebpage.net/asd/" & me.i d, when click on it, access says "https://mywebpage.net/asd/" without id. can me how create hyperlink on details form, navigate current element's webpage? find out! base url: ="https://myanimelist.net/anime/" & me.malid

Perl DateTime duration format not displaying years -

i'm having troubles difference calculation between 2 dates. my $todaydate = datetime->now; @updatedatefields = split /\//, $proteinobj->{lastupdate}; #yyyy/mm/dd $updatedatetime = datetime->new( year => @updatedatefields[0], month=> @updatedatefields[1], day=> @updatedatefields[2] ); $dayssincelastupdate = $todaydate - $updatedatetime; $dfd = datetime::format::duration->new(pattern => '%y years, %m months, %e days'); print "last update was: ". $dfd->format_duration($dayssincelastupdate). " ago.\n"; and output this: last update date: 2015/01/13 last update was: 0 years, 22 months, 0 days ago. it does't display 1 years, 10 months, 0 days ago. you need enable normalise option in datetime::format::duration object, this my $dfd = datetime::format::duration->new( pattern => '%y years, %m months, %e days', normalise => 1, );

How can I add a @media query through the chrome inspector? -

Image
if @media(min-width: 375px) in chrome inspector drops code try enter body define more of rule. is possible add @media rules through inspector? it looks though styles editor panel doesn't support adding @media rules. however, can around clicking on inspector-stylesheet link open in sources panel. possible enter @media query , changes reflected immediately. you can consequently see in styles panel afterwards , modify rule , css properties inline. initial creation doesn't support.

How to get list of all files and folders in ftp server (C++) -

i need list of files , folders in ftp server. is there similar command nlst entire server, not current directory? i use pasv mode. connect server: void create_socket(int &sock, const char* server_ip, const unsigned short server_port) { struct sockaddr_in server_addr; memset(&server_addr, 0, sizeof(server_addr));// 0 out structure server_addr.sin_family = af_inet;// internet address family server_addr.sin_addr.s_addr = inet_addr(server_ip);// server ip address server_addr.sin_port = htons(server_port);// server port if ((sock = socket(pf_inet, sock_stream, ipproto_tcp)) < 0) { } if (connect(sock, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) { std::cout << "connect error: " << strerror(errno) << std::endl; exit(1); } } the full list of ftp service commands starts @ page 29 in rfc 959 . there's no "list entire content of server" command; probable it's becaus...

web.xml - Where is the right place for spring configuration files? -

why there must <init-param> in <servlet> node <param-name> "contextconfiglocation" ? because if comment <init-param> group project not load? <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>archetype created web application</display-name> <!-- spring mvc dispatcher servlet --> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value></param-val...

Getting all NOT matching entries across a link table in ms-access -

Image
i have following relations in database: there different trainings in company , repeated 2-3 times year. now want tbl_events entries tbl_employee entry has no relation , display them in report. so far, i've tried make query giving me employess ev_name visited. qry_visited: select tbl_employee.em_number ,tbl_event.id ev_visited_id ( tbl_event inner join tbl_date on tbl_event.[id] = tbl_date.[da_f_event] ) inner join ( tbl_employee inner join tbl_training on tbl_employee.[id] = tbl_training.[tr_f_employee] ) on tbl_date.[id] = tbl_training.[tr_f_date]; and wrote second query: qry_unvisited select qry_visited.em_number ,tbl_event.ev_name ,qry_visited.ev_visited_id qry_visited right join tbl_event on qry_visited.ev_visited_id = tbl_event.id (((qry_visited.ev_visited_id) null)); these queries work together, if limit first 1 1 employee. rather have 1 recordset em_number , ev_name employees. i researched couple of days on working (and worki...

c# - Fastest method to remove Empty rows and Columns From Excel Files using Interop -

Image
i have lot of excel files contains data , contains empty rows , empty columns. shown bellow i trying remove empty rows , columns excel using interop. create simple winform application , used following code , works fine. dim lstfiles new list(of string) lstfiles.addrange(io.directory.getfiles(m_strfolderpath, "*.xls", io.searchoption.alldirectories)) dim m_xlapp = new excel.application dim m_xlwrkbs excel.workbooks = m_xlapp.workbooks dim m_xlwrkb excel.workbook each strfile string in lstfiles m_xlwrkb = m_xlwrkbs.open(strfile) dim m_xlwrksheet excel.worksheet = m_xlwrkb.worksheets(1) dim introw integer = 1 while introw <= m_xlwrksheet.usedrange.rows.count if m_xlapp.worksheetfunction.counta(m_xlwrksheet.cells(introw, 1).entirerow) = 0 m_xlwrksheet.cells(introw, 1).entirerow.delete(excel.xldeleteshiftdirection.xlshiftup) else introw += 1 end if end while dim intcol integer = 1 while i...