Posts

Showing posts from January, 2015

d3.js - Import d3js into Ionic2 typescript project -

i cannot wrap head around how can import d3js library in ionic typescript projet. installed library using : npm install d3 --save-dev the library in node_modules/d3. in page modules, try import using every possible path, example : import * d3 'd3/d3' import * d3 '../../../node_modules/d3/d3' i error: error ts2307: cannot find module 'd3/d3'. or error ts2307: cannot find module '../../../node_modules/d3/d3'`. any hint me ? angular version 2.0.0-rc.1 ionic : 2.0.0-beta.9 thanks i used workaround issue. what did : link d3js in index.html (at end of file, bellow app.bundle.js): <script src="https://d3js.org/d3.v3.min.js"></script> then in page.ts (before @component) : declare var d3: any; and can use : d3.select("#graph svg").remove(); so not using import (you should delete import if want use solution)

angular - Alpha router navigation by router -

i migrating new router. before, had: this._router.navigate(['main', 'home']); and route config was; main (parent view) ---home (child view) now, have following: {path: 'main', component: maincomponent, children:[ {path: 'home', component: homecomponent, children:[..] ....] however, following doesn't work: this._router.navigate(['main', 'home']); it doesnt throw error or anything. missing? navigation in new router should work this: this._router.navigate(['/main/home']);

camera - How can I program automatic gain control in C# ? -

i drive basler camera c# program , perform automatic gain control gain automatically adjusted according brightness. need because @ first glance, did not realize how visualized it. i thought test brightness of image (pixel brightness) , if not maximum can therefore increment gain. therefore little program allow automatic gain control of camera. right approach? or advise me rather else? a library supplied camera , control camera. user has opportunity capture photo, video capture , stop video capture. can control gain manually. wish program automatic gain, say, gain automatically adjusted depending on intensity of captured image. users activate setting , gain setting automatically. i thank in advance, sebbur

swift - Pop view controller using Screen edge pan gesture recogniser not following the thumb -

Image
as i've added custom bar navigation bar button item i've lost ability use default function go back. i'd have ability use "swipe edge" go back. i've added edge pan gesture recogniser , connected @ibaction, dismissing action happens pan gesture recognised. instead of following thumb (as seen in other apps), current view moves out predefined animation. how make animation following thumb using edge pan gesture recogniser? @ibaction func edgeswipe(sender: anyobject) { navigationcontroller?.popviewcontrolleranimated(true) } there's no need add edge pan gesture recogniser. following @beyowulf's suggestions i've been able implement swipe go feature behaves same way default system implementation - views edge follows thumb swipe dismiss it. so i've removed screenedge pan gesture recogniser storyboard , removed related @ibaction . i've made first view controller delegate interactivepopgesturerecognizer . here's code...

How to delete item from array angularjs? -

why can't remove item array posts? html tag delete item html tag <span ng-click="remove($index)"> delete</span> //angularjs method try delete item blog.remove = function(index) { blog.posts.splice(index, 1); }; //angular array posts blog.posts = [{ "title": "blog post one", "comments": [ { "body":"lorem ipsum dolor sit amet, consectetur adipisicing elit. ", "author": "trollguy87" } ]}]; where can problem? try passing item function , getting index item. as mentioned in below thread. how delete item or object array using ng-click?

javascript - Refreshing page on a back button in angular/ionic -

i trying refresh page on button new data article list. more specific have article list, , article page, on both of them have option of liking article. when user likes article on article page, if hits button icon on article list page won't refreshed new state. have tried making function on clicking button, , getting data again, icon doesn't change. data on console.log new data , value like=1 correct if user has liked article, icon doesn't change. code: i articles in front page controller: articleservice.all().then(function(data){ $scope.articles = data; }) in article page html have button link: <a ng-click="refresh()"></a> and in article list check value have , show icon according that: <a ng-if="article.like == 1" ng-click="like(article)" class="subdued"> <img class="social-images" src="icons/heart.svg"/> lik </a> <a ng-i...

css - Remove grid and border from p:chart barchart -

i trying remove grid , border in barchart of primefaces. please think new charts of primefaces. googled lot , have found solutions old tags of primefaces there new ones. <p:chart type="bar" model="#{reportservercontroller.horizontalbarmodelg}" styleclass="chartsize" > <p:ajax event="itemselect" listener="#{auftragbean.itemselectgutachten}" update="datatableg" /> </p:chart> so there possibility remove border , grid chart? to extend jqplot configuration have use extender functionality of primefaces' chart. in controller have set model property extender. example using primefaces showcase demo: private barchartmodel initbarmodel() { barchartmodel model = new barchartmodel(); model.setextender("chartextender"); chartseries boys = new chartseries(); boys.setlabel("boys"); boys.set("2004", 120); boys.set("2005...

return key of array if value is present PHP -

what fastest way check if variable present in array value , return key of it? example: $myarray = [ "test" => 1, "test2" = 2, "test3" = 3]; $var = [1,6,7,8,9]; what need if($var in $myarray) return (in case) "test". is possible without doing 2 loops? there functions in_array() returns key of value if found? you can use array_search foreach($var $value) { $key = array_search($value, $myarray); if($key === false) { //not found } else { //$key contains index want } } be careful, if value not found function return false may return value can treated same way false, 0 on 0 based array it's best use === operator shown in example above check documentation more

c# - Showing a progress dialog when loading a View/UserControl using MVVM: Which events should I use? -

i want show loading dialog while opening view / usercontrol takes while open. know can use loaded event close dialog once ui laid out , shown. doing in sample code shown below. my question is: there event can use in similar manner open dialog when layout/loading process starts? i open loading dialog viewmodel opens view / usercontrol , spread out logic. furthermore, since using messaging (from mvvmlight) signal view / usercontrol load result in unclean solution imo. ideas how achieve this? view : <i:interaction.triggers> <i:eventtrigger eventname="loaded"> <i:invokecommandaction command="{binding viewloadedeventhandlercommand}" /> </i:eventtrigger> </i:interaction.triggers> viewmodel : private icommand viewloadedeventhandlercommand; public icommand viewloadedeventhandlercommand { { if (viewloadedeventhandlercommand == null) viewloadedeventhandler...

Set relative output directory in R -

i have r script reads data multiple xlsx files, converts them dataframe , creates folders in directory @ computer based on row values of dataframe. i've set main directory in beginning of code that: choose.dir(getwd(), "choose suitable folder") and output directory folders created, as: pth <- "c:/users/dev/desktop/test/" i want run script @ multiple computers, means output directory named pth not same. there way set relative output path, every time run script specify want results located? tried pth <- choose.dir(default = "", caption = "choose output path") although dialogue window pops , choose desired directory, can't see of folders there. this code far: #choose working directory choose.dir(getwd(), "choose suitable folder") library(xlsx) library(tcltk) #get file names f = list.files("./") #read files dat <- lapply(tk_choose.files(caption="choose files"), function(i) { x ...

ARM assembly if(data & 0x01) rGPGDAT &= ~(0x1<<7); -

now i'm study how control arm gpio assembly language. i'm trying change c source assembly language. but i'm difficult writing part if(data & 0x01) rgpgdat &= ~(0x1<<7); if(data & 0x02) rgpgdat &= ~(0x1<<6); if(data & 0x03) rgpgdat &= ~(0x1<<5); if(data & 0x04) rgpgdat &= ~(0x1<<4); i think should use tst. don't know how dealt "if" you should able without branches: mov r1, <your data> ; change accordingly mov r2, <rgpgdat> ; change accordingly tst r1,#1 andne r2,#$ff -1 tst r1,#2 andne r2,#$ff -2 tst r1,#4 andne r2,#$ff -4 tst r1,#8 andne r2,#$ff -8 the key instruction , can define contition instruction executed (in case z=0) if bit set in r1, tst clears 0 flag, , andne clear bit in r2 (not sure if need andne or andeq here. loop more elegant but: i'm not @ home atm, can't write propper code)

JavaScript Creating array in object and push data to the array -

i'm new programming. i'm trying react , have function addcomment executed when user adds comment news.i need create in moment property comments (array) , assign or push array inputcommentvalue value. right rewrite 0 element of array , can't add new element. can please tell me put push method? thank you! var articles = [{ title: "sit amet erat", text: "nam dui proin leo odio porttitor id consequat in consequat ut nulla sed accumsan" }, { title: "pulvinar sed", text: "velit id pretium iaculis diam erat fermentum justo nec condimentum" }] addcomment(index, inputcommentvalue){ articles = [...articles], articles[index].comments=[inputcommentvalue]; this.setstate({articles:articles}); } assuming data exist in component's state , handler that addcomment(index, inputcommentvalue){ // copy array , not mutate state let articles = [...this.state.articles]; // check if comments not exist if(!art...

arrays - Where do the square brackets come from? -

package main import ( "fmt" "log" ) func main() { := []string{"abc", "edf"} log.println(fmt.sprint(a)) } the above go program print following output, slice value inside square brackets "[]" . 2009/11/10 23:00:00 [abc edf] and want know in source code [] added formatted string. i checked source code src/fmt/print.go file, couldn't find exact line of code this. could provide hint? you printing value of slice. formatted / printed in print.go , unexported function printreflectvalue() , line #980: 855 func (p *pp) printreflectvalue(value reflect.value, verb rune, depth int) (wasstring bool) { // ... 947 case reflect.array, reflect.slice: // ... 979 } else { 980 p.buf.writebyte('[') 981 } and line #995: 994 } else { 995 p.buf.writebyte(']') 996 } ...

Why are my cookies not being set Node.JS and cookie-parser? -

so i've been working on project node.js , trying set cookie based of id passed variable - code working yesterday today can console log query.id fine yet cookie undefined , can't figure out why - dealt before , can shed light? app.get('/home', function(req, res) { console.log(req.query.id); if (res.query != undefined && res.query.id != undefined) { res.cookie('user_id', req.query.id); res.send(req.cookies.user_id); }; console.log(req.cookies.user_id); var user_id = req.cookies.user_id; console.log(user_id); var project = []; retrieve_projects = connection.query('select * projects, project_users project_users.user_id = '+user_id+' , project_users.project_id = projects.id' , user_id, function (err, result){ //console.log(result); //throw err; (var = 0; <= result.length; i++) { if (result[i] != undefined) { //console.log(result[i]); var tempproject ={ project_...

objective c - How to add multiple view controller in a page controller -

i want add multiple view controller in page controller view controller can scroll left , right side in page view controller. how this..? you need implement uipageviewcontrollerdatasource. documentation found here: https://developer.apple.com/library/ios/documentation/uikit/reference/uipageviewcontrollerdatasourceprotocolref/index.html in the pageviewcontroller:viewcontrollerbeforeviewcontroller: pageviewcontroller:viewcontrollerafterviewcontroller: methods return uiviewcontrollers want show. with the setviewcontrollers:direction:animated:completion: method uipageviewcontroller can set initial uiviewcontroller.

.net - How to traverse multiple Log/Text Files of approx 200 MB Each using C#? and Apply Regex -

i have develop utility accepts path of folder containing multiple log/text files of around 200 mb each , traverse through files pick 4 elements lines exist. i have tried multiple solutions, all solutions working fine smaller files when load bigger file windows form hangs or shows "outofmemory exception". please solution 1: string textfile; string re1 = "((?:2|1)\\d{3}(?:-|\\/)(?:(?:0[1-9])|(?:1[0-2]))(?:-|\\/)(?:(?:0[1-9])|(?:[1-2][0-9])|(?:3[0-1]))(?:t|\\s)(?:(?:[0-1][0-9])|(?:2[0-3])):(?:[0-5][0-9]):(?:[0-5][0-9]))"; folderbrowserdialog fbd = new folderbrowserdialog(); dialogresult result = fbd.showdialog(); if (!string.isnullorwhitespace(fbd.selectedpath)) { string[] files = directory.getfiles(fbd.selectedpath); system.windows.forms.messagebox.show("files found: " + files.length.tostring(), "message"); foreach (string filename in files) { textfile = file.readalltext(filename); matchcollection mc = ...

php - Password expired in Magento when trying to add Database -

i have problem. when try add database during magento installation error message comes up. know answers error? error message: sqlstate[hy000] [1862] password has expired. log in must change using client supports expired passwords.

Export GitLab wiki attachment -

gitlab wiki great tool maintain documentation. comes convenient web interface wiki repository (git access) in order edit wiki. unfortunately, when adding attachments article via web interface, attachment not saved inside of wiki repository (git access). there way add attachment wiki without using git access? to put bluntly, no there isn't. (at least not yet, of version 8.9) files uploaded attachment being put in uploads/ folder global.

c# - How to add a Web API service to a non-MVC Asp site? -

with of several online tutorials, this one, still struggling add web api service existing asp site, not mvc. i added project new item of type web api controller class(v2.1), named abccontroller.cs, , vs2015 asked me put in app_code directory. default code has handlers get, put etc. sounded me on right track. i added default route in global.asax.cs in tutorial: routetable.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); this got built after adding reference system.web.http.webhost not mentioned in tutorial. sounded still on right track. however, doesn't work. run site in debug , gives me 404 not found: http://localhost:54905/api/abc i tried run on production server iis7, of course second test web site not interfere version in production. however, ran error microsoft.web.infrastructure dll not foun...

php - Update two MySQL Databases -

i have read on several threads possible update 2 databases using inner join update query unable work, throws error: fatal error: uncaught exception 'pdoexception' message 'sqlstate[23000]: integrity constraint violation: 1052 column 'category' in field list ambiguous' in c:\xampp\htdocs\update.php:79 stack trace: #0 c:\xampp\htdocs\update.php(79): pdostatement->execute(array) #1 {main} thrown in c:\xampp\htdocs\update.php on line 79 line 79: $result = $stmt->execute($prepare); if (isset($_post['update'])) { $category = isset($_post['category']) ? $_post['category'] : null; $manufactuer = isset($_post['manufactuer']) ? $_post['manufactuer'] : null; $model = isset($_post['model']) ? $_post['model'] : null; $serial = isset($_post['serial']) ? $_post['serial'] : null; $itemcondition = isset($_post['itemcondition']) ? $_post['itemcondition...

php - Laravel malformed character UTF-8 -

Image
when try grab list of directories , use list in json response, error response has malformed utf-8 characters. know have letters "Æ Ø Å" in directories. when use dd($directories) can see "b" infront of every directory contains "Æ Ø Å" letter (as can see in photo). i tried use this, not work either. return response() -> json($movies, 200, ['content-type'=> 'application/json; charset=utf-8'], json_unescaped_unicode); edit: code have now. $drives = ['m1', 'm2', 'm3', 'm4']; $movies =[]; foreach ($drives $drive) { $disk = storage::disk($drive); foreach ($disk -> directories() $movie) { $movies[] = $movie; } } return response() -> json($movies, 200, ['content-type'=> 'application/json; charset=utf-8'], json_unescaped_unicode); you using strings coming filesystem filenames. such strings typcally not in utf-8 , use iso-8859-1 (usually). coin...

php - How to fix the contact form -

i use html page , need fix contact form on page. page contain greek characters , allso need use in contact form. so... php code <?php $field_name = $_post['lastname']; $field_email = $_post['email']; $field_message = $_post['yourmessage']; $field_subject = $_post['select']; $field_state = $_post['perioxi']; $field_phone = $_post['phone']; $mail_to = 'info@mydomain.gr'; $subject = 'from: '.$field_name; $body_message = 'from: '.$field_name."\n"; $body_message .= 'for ' $field_subject."\n"; $body_message .= 'perioxi: '.$field_state."\n"; $body_message .= 'phone: '.$field_phone."\n"; $body_message .= 'e-mail: '.$field_email."\n"; $body_message .= 'message: '.$field_message; $headers = 'from: '.$field_email."\r\n"; $headers .= 'reply-to: '.$field_email."\r\n"; $mail_status = mail($m...

yii - Redirect to Home Page using Nav Bar -

i want add 1 button in nav bar redirect index.php. please me complete task.i want redirect below url http://localhost/backup/web/index.php i trying below code, echo nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'], 'encodelabels' => false, 'items' => [ ['label' => 'contactus', 'url' => ['index.php']], ], ]); try this 'url'=> yii::$app->homeurl

How do I show asp.net error details in Microsoft Edge? -

Image
this question has answer here: can (how i) disable “friendly http error messages” in ms edge browser? 1 answer deploying website: 500 - internal server error 20 answers how show asp.net error pages (yellow screen of death) in microsoft edge? more specifically, how disable friendly http error messages @ browser level? os trying on windows server 2016 standard technical preview 5. i have made sure have <customerrors mode="off"/> under system.web in web.config i can use eventvwr find asp.net errors including stack trace in eventlog know there proper asp.net errors happening. i can' see relevant setting under edge -> advanced settings. i need disable friendly error message in edge. ideas? in ie11 used here update : i'm voting close own...

java - How to display DynamicReports in browser without download to cliend drive? -

i have display reports dynamic reports . use netbeans , tomcat 7. eventually, must uploaded cloud openshift. used dynamicreports create simple report (code snippet): connection conn=null; try { class.forname(dbconnstrings.driver); conn = drivermanager.getconnection(dbconnstrings.url + dbconnstrings.dbname+dbconnstrings.sslstate, dbconnstrings.username, dbconnstrings.password); } catch (exception e) { e.printstacktrace(); } jasperreportbuilder report = dynamicreports.report(); report .columns( columns.column("tank id", "id", datatypes.integertype()), columns.column("tank name", "name", datatypes.stringtype()), columns.column("label", "label", datatypes.stringtype()), columns.column("description", "descrshort", datatypes.stringtype())); report.setdatasource("sele...

Can anyone explain me the example of an exploit in Python’s pickle module? -

i want understand the example of exploit in python pickle module? got code github show exploit in pickle module, still not able understand it. please guide me. import os import pickle class exploit(object): def __reduce__(self): return (os.system, ('cat /etc/passwd',)) def serialize_exploit(): shellcode = pickle.dumps(exploit()) return shellcode def insecure_deserialize(exploit_code): pickle.loads(exploit_code) if __name__ == '__main__': shellcode = serialize_exploit() insecure_deserialize(shellcode) when unpickle object, __reduce__ method called. first argument __reduce__ callable, is, function. next argument tuple of arguments __reduce__. in case, when exploit unpickled, os.system called, , given 'cat /etc/passwd' argument. os.system allows make system calls according host operating system. in case, it's linux. cat prints file's contents standard out, , /etc/passwd information on system's u...

Mongodb - Sort by computed field -

i'm struggling finding solution problem mongo db: i need run query on collection high write/read ratio. query consists in sorting documents field derived other fields belonging same document. moreover, 1 of fields size of array, makes harder. a simple example: d1 - { _id: 1, field: 1, array_field: [a,b,c,d] } -> score = 1 + 4 = 5 d2 - { _id: 2, field: 2, array_field: [a,b] } -> score = 2 + 2 = 4 expected result: d1 - { _id: 2, score: 4 } d2 - { _id: 1, score: 5 } (the score not required in resultset) the solutions i've tried far: add score field of document, consistently updated other fields updated. problems: it not possible parameterize query (tuning) once score has been computed it expensive because index on score has updated frequently create aggregation pipeline makes things easy develop , solves parameterization problem. however, performance drop high beacuse mongo can't rely on use indexes on computed fields, causing memory issue...

grails - Authentication failure event for oauth provider -

i have added spring security core , oauth provider in grails application my config: // added spring security oauth2 provider plugin: grails.plugin.springsecurity.oauthprovider.clientlookup.classname = 'com.oauth.client' grails.plugin.springsecurity.oauthprovider.authorizationcodelookup.classname = 'com.oauth.authorizationcode' grails.plugin.springsecurity.oauthprovider.accesstokenlookup.classname = 'com.oauth.accesstoken' grails.plugin.springsecurity.oauthprovider.refreshtokenlookup.classname = 'com.oauth.refreshtoken' grails.plugin.springsecurity.logout.postonly = false //grails.plugin.springsecurity.successhandler.defaulttargeturl = '/client/index' // added spring security core plugin: grails.plugin.springsecurity.userlookup.userdomainclassname = 'com.auth.user' grails.plugin.springsecurity.userlookup.authorityjoinclassname = 'com.auth.userrole' grails.plugin.springsecurity.authority.classname = 'com.auth.role'...

properties - Kotlin extension function on mutable property -

i'm trying set extension function on mutable property can reassign property in extension function. wanted know if possible. my goals make date extensions easy access. example: fun date.adddays(nrofdays: int): date { val cal = calendar.getinstance() cal.time = cal.add(calendar.day_of_year, nrofdays) return cal.time } this function adds number of days date using calendar object. problem each time have return new date can confusing reassign each time use function. what i've tried: fun kmutableproperty0<date>.adddays(nrofdays: int) { val cal = calendar.getinstance() cal.time = this.get() cal.add(calendar.day_of_year, nrofdays) this.set(cal.time) } unfortunately can't used on date object. is possible this? unfortunately, cannot define extension on member property , call fluently in kotlin 1.0.3. your extension can rewritten work this: fun <t> kmutableproperty1<t, date>.adddays(receiver: t, nrofda...

javascript - Hiding opacity of content with angular with -

Image
i'm trying hide 3 bicycles when click left arrow can transition next 3 bicycles app.js products object. tried ng-hide, makes them disappear causing 2 arrows snap next each other in screenshot below. if hide opacity, stay , can change images while invisible. can me this? html <!doctype html> <html ng-app='formapp'> <head> <title>bicycle app</title> <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"> <link href="app.css" rel="stylesheet"> </head> <body> <div class="header"> <div class="container"> <div class='row'> <div class='col-md-12'> <i class="fa fa-bicycle" aria-hidden=...

installation - Include .NET Framework to setup -

i'm creating installation wpf-application simple "setup project". @ window prerequisites-settings i'm choosing "microsoft .net framework 4.5.2 (x86 und x64)" , required components in same directory application because need offline installation. now i've put .net-installation-file in every possible directory... - in application directory - in setup-directory - in directory: c:\program files (x86)\microsoft visual studio 14.0\sdk\bootstrapper\packages\dotnetfx452 - in directory: c:\program files (x86)\microsoft visual studio 14.0\sdk\bootstrapper\packages\dotnetfx452\de ... nothing works. i error: original (german): error: um "erforderliche komponenten von demselben speicherort wie die anwendung herunterladen" im dialogfeld "erforderliche komponenten" aktivieren zu können, muss die datei "dotnetfx452\ndp452-kb2901907-x86-x64-allos-deu.exe" für das element "microsoft .net framework 4.5.2 (x86 und x64)" auf...

php - Dynamically load class by name in Zend 2 -

i trying instance of class name. have controller , in controller instance of class classname . know class in namespace mymodule\entity . what best way dynamically create instance of class zend 2 ? namespace mymodule\controller; class mycontroller extends abstractactioncontroller { public function indexaction() { $classname = "myclass"; // file myclass.php $class = ??? // create instance $classname $class->process(); } in zf1 do $class = new mymodule_entity_classname(); i don't know if changed in zf2.

php - Telegram API, get the sender's phone number? -

i realize not possible use a bot receive sender's phone number. do, however, need implement bot-like client, responds messaging it. using php on apache. it not bot, not take commands, rather responds sent text has phone number. add user contact (using phone number), , send text it. my goal realise sender's phone number receive it, saw on telegram api there's peer id, can't find how phone number if that's possible... try lib github https://github.com/irazasyed/telegram-bot-sdk and code create 'visit card' button in private chat: $keyboard = array( array( array( 'text'=>"send visit card", 'request_contact'=>true ) ) ); //user button under keyboard. $reply_markup = $telegram->replykeyboardmarkup([ 'keyboard' => $auth_ke...

java - JavaFX UI elements hover style not rendering correctly after resizing application window -

at times, ui elements have hover style not render @ , white box left in it's place. happens after resize application window , when ui element outside of original bounds of application window. button shown in images below not render correctly after removing mouse pointer hover position, issue occur whenever button needs repainted. "device logging" button being hovered mouse, before resizing window. after resizing window. both "device logging" , "misc tests" buttons 100% outside of original bounds of window. "cloud server migration" button still rendering correctly. i have set styles, removing them has no effect. issue seems appear when there other processing taking place, such running firmware update function. tells me there may taking ui time, have expected affect every ui element, not ones. one other note, ui converted swing javafx, of threading did not include use of task or platform.runlater(). have since made sure ui upda...

.htaccess - apache mod rewrite (all HTTP requests to HTTPs) -

after setting letsencrypt on vps these rewrite conditions set letsencrypt: rewriteengine on rewritecond %{server_name} =xy.com [or] rewritecond %{server_name} =www.xy.com rewriterule ^ https://%{server_name}%{request_uri} [end,qsa,r=permanent] it works fine, redirect requests ' https://www.xy.com https too. tried using code: rewriteengine on rewritecond %{server_name} =xy.com [or] rewritecond %{server_name} =www.xy.com [or] rewritecond %{server_name} =https://www.xy.com rewriterule ^ https://%{server_name}%{request_uri} [end,qsa,r=permanent] it doesn't work. idea do? none of answers worked. here's file placed in www/html/xy/public folder. requests point this, don't know if maybe causes problem? <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes if not folder... rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] # handle front contr...

sql - Group by error ssms, should be quick fix but can't find it -

below query. i'm getting error in group by statement, , cannot figure out why. included error well. select a.[order date] ,a.[customer #] ,a.[order #] ,a.[order type] ,ordertotal ,case when c.offertype in ('catalog') 'y' else 'n' end 'catalog match' ,b.channelgroup lwpim.dbo.marketingreporting left join ( select sum([total price]) ordertotal lwpim.dbo.marketingreporting [order date] between '2016-01-01' , '2016-06-30' group [order date] ,[total price] ) d left join user_sandbox.dbo.offercodeoffertype c on a.[offer number] = c.offercode , a.[matchback offer number] = c.offercode left join user_sandbox.dbo.gadata2016 b on a.[order #] = b.order_number group a.[customer #] ,a.[order #] ,a.[order date] ,a.[order type] ,ordertotal ,case when c.offertype in ('catalog') 'y' ...

ruby on rails - Changing checkbox icon with simple_form -

i'm new @ rails , web apps , appreciate if this. using simple_form , trying change checkbox icon image css(scss) seems not working. codes below. <div class="col-md-6"> <%= f.input :is_something, as: :boolean, input_html: { class: 'custom-check-box' } %> </div> generated code <div class="col-md-6"> <div class="input boolean optional test_is_somethiing"><input value="0" type="hidden" name="test[is_something]" /><label class="boolean optional checkbox" for="test_is_somethiing"><input class="boolean optional custom-check-box" type="checkbox" value="1" checked="checked" name="test[is_something]" id="test_is_somethiing" />label</label></div> </div> and scss is .custom-check-box { opacity: 0; vertical-align: middle; input[type=checkbox] + label:after ...

php - Creating a laravel txt with some data from database in LARAVEL -

how can create method in laravel in user controller when click on button in view download txt file info tha generating query user::select('id','name','lastname') ->orderby('id','desc') ->take(100) ->get(); printing these 3 fields of users table in 3 column in txt file. if can guide me doing via jquery-ajax perfect ! updated problem solved guy below ! //controller public function downloadtxt() { $txt = ""; $datas = user::select('id','name','lastname') ->orderby('id','desc') ->take(100) ->get(); foreach($datas $data){ $txt .= $data['id'].'|'.$data['name'].'|'.$data['lastname'].php_eol; } $txtname = 'mytxt.txt'; $headers = ['content-type'=>'text/plain', 'test'=>'yoyo', 'content-disposi...

objective c - React native bridge is sometimes nil in swift module -

i have swift module created, starts listening on gcdasyncudpsocket when connect method called swift @objc(mymodule) class mymodule: nsobject, gcdasyncudpsocketdelegate { var bridge: rctbridge! var socket: gcdasyncudpsocket! func methodqueue() -> dispatch_queue_t { return dispatch_queue_create("com.mycompany.greatapp", dispatch_queue_serial) } @objc func connect(resolver resolve: rctpromiseresolveblock, rejecter reject: rctpromiserejectblock) { socket = gcdasyncudpsocket(delegate: self, delegatequeue: methodqueue()) //...start listening, etc } @objc func udpsocket(sock: gcdasyncudpsocket!, didreceivedata data: nsdata!, fromaddress address: nsdata!, withfiltercontext filtercontext: anyobject!) { bridge.eventdispatcher().sendappeventwithname("got_msg", body: nil) } } i've created private implementation #import <foundation/foundation.h> #import "rctbridgemodule.h" @interface rct_extern_module(mymodule...

arrays - For loop to last value in matrix -

i looping down each row in array, , array variable size 76 or columns , 1000 rows. but, matrix not full, , rows not fill 1,000. however, need keep matrix size, may grow in future. syntax going until hit last element in array? stuck with. thanks do while <= 1000 you want loop until array value isempty(). option base 0 dim long dim myarray(75, 999) while not isempty(myarray(i, 0)) = + 1 loop or option base 1 dim long dim myarray(76, 1000) = 1 while not isempty(myarray(i, 0)) = + 1 loop shai rado correct should use dynamic array. excel vba array tutorial

c++ - what is the issue with the following code as I am receiving 'w' is not defined? -

i wrote class. not know why receiving w not defined, although defined that. know problem? #include "stdafx.h" #include <iostream> #include <string> using namespace std; class add{ public: void counter(); void z(); string w; }; void z(){ cin>>w; getline(cin,w); cout<<w; } int main(){ add s; s.z(); cin.get(); } you need write void add::z(){ when defining member function void z() . else you're defining global function void z() , , w cannot found. that's confusing compiler.

mysql - SQL Query Returning Deleted Rows -

i have following table in database, stated data in it: support_user_roles table: user_id | role_id 1 | 1 1 | 2 2 | 2 *2* | *1* the bottom row, notated '*' has been deleted , in sql developer there no sign of it. i running following query: select su.user_id , su.username , sur.role_id , sr.role_name support_users su , support_users_roles sur , support_roles sr su.user_id = sur.user_id , su.is_active != ‘n’ , sr.role_id = sur.role_id , sr.is_active != ‘n’ and returning following: { (user_id : 1, role_id : 1), (user_id : 1, role_id : 2), (user_id : 2, role_id : 1), (user_id : 2, role_id : 2) } as can see, still giving me: (user_id : 2, role_id : 1) even though doesn't exist anywhere anymore. i using java, jsf, primefaces, sql developer, hibernate, weblogic , eclipse ide. i'm not sure if i'm massively missing here , need refresh/update somewhere. i...

Using Django debug toolbar to profile POST responses -

django debug toolbar great tool profile slow sql queries - among other things. i'm able responses in django app. question is: how profile (and optimize) post responses? i'm newbie , can't figure out how on debug toolbar. should using else entirely) please advise, , in advance. django-debug-toolbar works same , post requests. however, 1 common ui design pattern successful form submissions lead redirect, loads new view , makes lose sql history in ddt. if case, 1 of panels on ddt allows intercept redirects , inspect sql queries @ each step. also, if problem comes making ajax calls, should have @ answers question: how use django-debug-toolbar on ajax calls?

Why C++ doesn't support named parameter -

previously, worked python. in python used named parameter(keyword argument) function calls. wikipedia page named parameter tells c++ doesn't support it. why c++ doesn't support named parameter?. support in future version of c++ standard? why c++ doesn't support named parameter because such feature has not been introduced standard. feature didn't (and doesn't) exist in c either, c++ based on. does support in future version of c++ standard? maybe. proposal has been written it. depends on whether proposal voted standard.

javascript - removeattr required not working chrome browser -

i trying remove required attribute hidden fields. $('#divq9, #divq10, #divq11, #divq12, #divq13, #divq14, #divq15').find('input[type=radio]').removeattr('required'); the above code works in other browsers except chrome version < 50 please suggest work around same. using .prop('required', false) satpal says https://jsfiddle.net/moongod101/j4xtvw2h/

typescript - Angular 2: Inject service into class -

i have angular class represents shape. want able instantiate multiple instances of class using constructor. the constructor takes multiple arguments representing properties of shape. constructor(public center: point, public radius: number, fillcolor: string, fillopacity: number, strokecolor: string, strokeopacity: number, zindex: number) inside class want use service provides capability draw shapes on map. possible inject service class , still use constructor standard way. so want below , have angular automatically resolve injected dependency. constructor(public center: geopoint, public radius: number, fillcolor: string, fillopacity: number, strokecolor: string, strokeopacity: number, zindex: number, @inject(drawingservice) drawingservice: drawingservice) i've managed resolve problem. angular 2 provides reflective injector allows inject dependencies outside of constructor parameters. all had import reflective injector @angular/core . impor...

Angular 2 custom directive not binding sparkline barChart -

i trying write custom directive pass input values , bind data sparkline chart gives me error sparkline not function. below plunker: import { directive, elementref, hostlistener, input , oninit } '@angular/core'; @directive({ selector: '[mybarchart]' }) export class barchartdirective { private el: htmlelement; @input('mybarchart') barchartvalues: number[] = []; constructor(el: elementref) { this.el = el.nativeelement; } ngoninit() { this.el.sparkline(this.barchartvalues, { type: 'bar', barcolor: 'green', width: 300, height: '50', barwidth: 8, barspacing: 3, colormap: ["green", "yellow", "red"], chartrangemin: 0 }); } } http://plnkr.co/edit/bpy6kd1bsmzwtkszqjzv any appreciated @dfsq you need move initialization processing ngoninit lifecycle hook method: constructor(private el: elementref) { } ngoninit() { el.sparkline(this.barchartvalues, { type: ...

css - Transparent menu in revolution slider wordpress -

i'm using x theme themeco , revolution slider want make menu bar transparent slider behind it, top of slider background of menu bar. if make menu bar transparent, shows white above slider, no overlap. here link site: http://845.b40.myftpupload.com/ thanks in advance! it's hard without seeing code absolutely position header top of page, using like: header{ position:absolute; top:0; background:transparent; }

c# - How to convert nullable DateTime? -

string fc = ....... dictionary<string, string> fcdata = serializer.deserialize<dictionary<string, string>>(fc); if (!string.isnullorwhitespace(fcdata["diploma.graduationbegindate"])) datetime? graduationbegindate = convert.todatetime(fcdata["diploma.graduationbegindate"]); error : {"object reference not set instance of object."} this code . fcdata has value, count =11 , fcdata["diploma.graduationbegindate"] value 10.05.2016 why doesn't work ? me ? you can affect datetime datetime? : datetime t1 = somedate; datetime? t2; t2 = t1; <- works in contrary : datetime? t1 = somedate; datetime t2; t2 = t1; <- won't work, need cast t2 = (datetime)t1; hope help.

java - Apache Camel: FTP batch consumer doesn't print file batch index and file batch size -

i developing route download files ftp location batch-wise. please find below route - **from("ftp://user@ftphost/inbox?password=xxxx&binary=true&recursive=true") .log("batch index = ${header.camelfilebatchindex}, batch size = ${header.camelfilebatchsize}") .to("file:outbox");** the route works fine , files downloaded. batch details (i.e. camelfilebatchindex , camelfilebatchsize) not getting logged. please find below output - **2016-06-28 18:56:24.600 info 8696 --- [ main] com.camel.examples.camelapplication : started camelapplication in 9.814 seconds (jvm running 11.237)** **2016-06-28 18:56:28.594 info 8696 --- [/inbox] route1 : batch index = , batch size =** you using wrong names fields. can find constant values here: http://camel.apache.org/maven/current/camel-core/apidocs/constant-values.html#org.apache.camel.exchange.batch_index its camelbatchsize...

html - Angular2 routing click on menu item -

Image
i'm using angular2 . right user has click on menu item text go page: <li><a [routerlink]="['/login']">login</a></li> how can make sure when user clicks on blue goes next page? (i use flexbox). thankyou sounds css problem me. a elements inline default. can make them block -level take available space: li { display: block; }

python - Type error "must be string, not datetime.datetime" -

i've got error in view , don't have idea, wrong: from datetime import datetime month_dict in finished_by_month: month_values.append(month_dict['total']) month_date = datetime.strptime(month_dict['month'], '%y-%m-%d') when try see template i've got error: "must string, not datetime.datetime" i looking solution, can't find anything. maybe has got similar problem? assuming error occurring in strptime function, please make sure value referenced month_dict['month'] string , not in date time format. trying convert string time in particular format, value expected compiler string. for more details on format of time , additional learning, please visit https://docs.python.org/2/library/time.html note: basis of assumption last line require string format provided whereas above lines not throw particular kind of error.

javascript - React-Native - Object.assign children change -

sry if question still there searched , didn´t find solution. couldn´t hint out of developer.mozilla website objects.assign etc. described well. the question: how can change children of object? output described in following. sample-code var obj= {test: [{a: 2}, {b: 3}]}; var newchildren = [{a: 3}, {b: 5}, {c: 1}]; //i read obj key value following: var objkey = object.entries(obj)[0][0] //here want have code following result //my momentary regarding @webdeb var output = object.assign({}, {objkey: newchildren}) actual output: // {objkey: [{a: 3}, {b: 5}, {c: 1}]} wanted output: // {test: [{a: 3}, {b: 5}, {c: 1}]} i have no other option code in other format "input" needed in way described. , need set objkey variable, because have multiple keys in code wich have set multiple children. (doing filter stuff) thanks help br jonathan first of all, don't use object variable name.. ok, lets object obj without modification of obj var ...

c# - Timer resets after 60 seconds -

below code i'm attempting use elapsed timer on desktop task timer we're building. right when runs counts 60 seconds , resets , doesn't ever add minutes. //tick timer checks see how long agent has been sitting in misc timer status, reminds them after 5 mintues ensure correct status used private void statustime_tick(object sender, eventargs e) { counter++; //the timespan handle push elapsed time in seconds label can update user //this shouldn't require background worker since it's small app , nothing resource heavy var timespan = timespan.fromseconds(actualtimer.elapsed.seconds); //convert time in seconds format requested user displaycounter.text=("elapsed time in " + statusname+" "+ timespan.tostring(@"mm\:ss")); //pull thread updating ui application.doevents(); } quick fix i believe problem using seconds 0-59. want use totalseconds existing code: var timespan = timespan.fromsecond...

amazon web services - AWS CloudFront limitation -

Image
i trying use aws cloud front service 1 of request. able complete functionality, when search limitation of aws cloud front have found support 200 web distributions per account. question going use 1 web distribution url, sub urls, example: http:awscloudfronturl/object/folder1/1.jpg http:awscloudfronturl/object/folder2/2.png here http:awscloudfronturl base web distribution. in case how many urls can work? there limitation this? in advance. so limitation 200 distribution distributions going create using aws cf. sub urls same web distribution not counted separate web distribution. check screenshot below. in screenshot there 10 web distribution separate each application. again sub urls not separate web distribution part of same web distribution.

Android M Error on api 22, and requestPermissions() method not found -

i'm working in api 22, want compile project in android m 6.0, have code: declared @ top: private static final string[] required_permissions = new string[]{"read_external_storage"}; private static final int request_permissions = (integer) null; and on oncreate() : if(build.version.sdk_int >= build.version_codes.m) { linkedlist<string> missingpermissions = new linkedlist<>(); for(string p : required_permissions){ if(checkcallingorselfpermission(p) != packagemanager.permission_granted){ missingpermissions.add(p); } } if(!missingpermissions.isempty()){ string[] mparray = new string[missingpermissions.size()]; missingpermissions.toarray(mparray); requestpermissions(mparray, request_permissions); } } i inspired here checking problem , in eclipse giving me error on build.version_codes.m (m not found), , then, callback method requestpermissions(mparray, request_permissions) isn...