Posts

Showing posts from April, 2012

c++ - Truecrypt cannot build -

6>comsetup.obj : warning lnk4075: ignoring '/editandcontinue' due '/safeseh' specification 6> setup.vcxproj -> c:\truecrypt\source\setup\debug\truecryptsetup.exe ========== rebuild all: 6 succeeded, 0 failed, 0 skipped ========== this message after build truecrypt source code windows on visual studio 2012. succeeded file @ c:\truecrypt\source\setup\debug\truecryptsetup.exe not work. how can fix it? this warning can ignore. file seems have been compiled successfully, need put relevant dlls in same folder truecrypt.exe. these missing dlls makes program crash.

angularjs - Which application architecture i should follow? -

i have started new application. have organized angular & webapi single page application bit confused. application kind of invoicing application when going use third party apis intuit . want make solid decision before proceed further application architecture should follow. between single page application or asn traditional mvc 5.0 application. if guys have idea please share. honestly depends on kind of application is. if application not big , high priority on ux or design (like marketing / support / informational kind of applications) should go spa. but if application data driven means performing on huge data , result / data / information high priority should go traditional mvc 5.0 application. this isn't solve problem yet. mentioned using web api, please @ post https://softwareengineering.stackexchange.com/questions/246380/should-we-call-web-api-from-mvc-application-in-same-solution

networking - php curl response blank randomly -

we implementing api curl. send xml request , xml response. cases randomly did not receive response. when co-ordinated api provider told there no request hit on there server in case of blank response. how know, not hit on api provider server. there header response ? some troubleshooting curl options: curl_setopt($ch, curlopt_connecttimeout, 100); curl_setopt($ch, curlopt_timeout,100); curl_setopt($ch, curlopt_failonerror,true); curl_setopt($ch, curlopt_encoding,""); curl_setopt($ch, curlopt_verbose, true); curl_setopt($ch, curlinfo_header_out, true); curl_setopt($ch, curlopt_header, true); get results $data = curl_exec($ch); if (curl_errno($ch)){ $data .= 'retreive base page error: ' . curl_error($ch); } else { $skip = intval(curl_getinfo($ch, curlinfo_header_size)); $responseheader = substr($data,0,$skip); $info = curl_getinfo($ch); $requestheader = $info['request_header']; $info = var_export($info,true); echo "<pre>$r...

java - Displaying dropdown list depends on selected value from other list -

i working on project in spring mvc 4 , should display 3 dropdown lists second list depends on selected value first list , third on selected value in second list. i have defined enum: public enum type{ a{ getlistofsubtypes(){...}; getlistofobjectsbysubtype(objectlist subtype){...}; }, b{ getlistofsubtypes(){...}; getlistofobjectsbysubtype(objectlist subtype){...}; c{ getlistofsubtypes(){...}; getlistofobjectsbysubtype(objectlist subtype){...}; } }; getlistofsubtypes produce list of sub types. getlistofobjectsbysubtype produce list of objects sub types. is there way fetch directly in jsp file subtypes , objects type accordingly chosen type? or should have perform conversions in model? the first dropdown displays "a,b,c" list expected by: <form:select class="form-control input-sm" path="task.type"> <form:options items="${types}"/> </form:...

php - Place 3 box in a single row -

i fetching data images database , wish place maximum 3 images in single row , these images have hover effect on them working fine problem facing if using code display static images working fine if fetch data database not displaying properly. want display images in form 1st_image 2nd_image 3rd_image 4th_image 5th_image 6th_image 7th_image .. , on but getting images in form 1st_image 2nd_image 3rd_image 4th_image 5th_image 6th_image the code have is code of front page is <?php $sql = "select * category"; $result = mysqli_query($con, $sql); if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $catname=$row["catname"]; $catdesc=$row["catdesc"]; $catpic=$row["catpic"]; $id=$row["id"]; ?> <div id="effect-2" class="effects clearfix"> ...

In python, can I lazily generate copies of an iterator using tee? -

i'm trying create iterator lazily creates (potentially infinitely many) copies of iterator. possible? i know can create fixed finite number of copies doing iter_copies = tee(my_iter, n=10) but breaks down if don't know n ahead of time or if n infinite. i try along lines of def inf_tee(my_iter): while true: yield tee(my_iter)[1] but documentation states after using tee on iterator original iterator can no longer used, won't work. in case you're interested in application: idea create lazy unzip function, potentially use in pytoolz . current implementation can handle finite number of infinite iterators (which better plain zip(*seq) ), not infinite number of infinite iterators. here's pull request if you're interested in details. this barely touched upon in single example near bottom of itertools documentation, itertools.tee supports copying: import itertools, copy def infinite_copies(some_iterable): master, copy1 ...

java - Low Energy Bluetooth in Android using GATT -

i've done lot of reading le bluetooth , gatt i'm still struggling understand gatt is. make simple i'd express how i'd app work, , told if it's possible or not? basic premise used location tracker , beacons (maybe ibeacons specifically) placed around building , whenever enter range of beacon message sent server phone. idea doesn't need scan, phone listens , whenever beacon advertises, phones in range hear , raise event. scenario: client downloads app , enters building first time. the building has beacon in every room, advertising every 5 seconds example. when client walks room , in range of beacon, phone unfriendlier version of message "beacon 2 has rssi of -87". when leave room no longer hear message , nothing until hears message beacon. note: scenario doesn't involve scanning, looping or pairing. phone know has listen le bluetooth messages. so, possible? i've seen seems need scan , connect each beacon using gatt before can re...

Can't generate image using PHP -

why following code doesn't show image in browser, sees errors? <?php header("content-type: image/png"); $im = @imagecreate(110, 20) or die("cannot initialize new gd image stream"); $background_color = imagecolorallocate($im, 0, 191, 255); $text_color = imagecolorallocate($im, 0, 0, 0); $generator = substr(str_shuffle(str_repeat('abcdefghijklmnopqrstuvwxyz0123456789',5)),0,8); imagestring($im, 1, 5, 5, $generator, $text_color); imagepng($im); imagedestroy($im); ?> if have a(or multiple) space(s) before <?php cause failure. script works unless have space. <?php header("content-type: image/png"); //....etc. ?> not: <?php header("content-type: image/png"); //....etc. ?>

android - How to Get media for webRTC in webview? -

Image
i run app let start voice chat webrtc (it based in easyrtc) when call page android browser ask media resource , start chat ... when call webpage in android webview not request media , error : failed access local media error code permissiondeniederror ! in manifest add these permissions : <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.record_audio" /> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.modify_audio_settings" /> i know support in android l or later webview in android l , test sample in link ! can not run ! try add in manifest file: <uses-feature android:name="android.hardware.camera" android:required="true" />

Visual Studio Community 2013 Apache Server (PHP) -

is possible run apache server "vs community 2013" on windows 8.1 run php scripts? have got xammp , sublime text 3 php programming, code vs. have tried iis express, reason not working. guess, need apache server run php properly. possible configure iis rather apache run vs? apache not associated with, nor bundled alongside, vs2013. don't need apache specifcally, or iis specifically, need server daemon has php handler, either , there's documentation on how set php either, pick whichever 1 want. write scripts in whatever ide want - code writing aspect of php site not related how serve code. both apache , iis let fine (but different configurations, obviously, because they're different projects)

c++ - In CUDA / Thrust, how can I access a vector element's neighbor during a for-each operation? -

i trying scientific simulation using thrust library in cuda, got stuck in following operation for-each loop: device_vector<float> in(n); for-each in(x) in in out(x) = some_calculation(in(x-1),in(x),in(x+1)); end i have looked stackoverflow.com , find similar questions: similar questions 1 but seems using transform iterator possible when some_calculation function done between 2 parameters, transform iterator passes 2 parameters @ most. then, question 2: similar questions 2 the discussion ended without conclusion. i believe simple problem because it's natural requirements parallel calculation. tell me do? fancy iterators key sort of operation, isn't intuitive in thrust. can use zip_iterator create tuples of values can iterated over, typical f(x[i-1], x[i], x[i+1]) type function, this: #include <iostream> #include <cmath> #include <thrust/iterator/zip_iterator.h> #include <thrust/tuple.h> #include <thrust/transfo...

server - Can't access a folder on a subdomain on bluehost -

i've tried best can't seem find same issue have, bluehost. i have main domain bluehost , hosting. example, let's call helloworld.com. i purchased domain goodbyeworld.com bluehost. created subdomain hello.goodbyeworld.com pointed specific folder named goodbyeworld on main hosting account. as result, both helloworld.com/goodbyeworld , hello.goodbyeworld.com should show point same directory. the issue i'm having is, have folder named 'icons' in goodbyeworld folder has single file named icon.png. i can't seem figure out why helloworld.com/goodbyeworld/icons/icon.png works, hello.goodbyeworld.com/icons/icon.png doesn't work though both technically point same location. however, else works. example, have folder named 'images' , can access in folder fine. any appreciated, i'm perplexed. here bluehost support told me: "the issue default, directories named "icons" link apache os's icons directory. renami...

Solr Server is not starting in rails in ubuntu -

i using rake sunspot:solr:start start solr server & displays started solr ... when browse localhost:8982 , doesn't display anything. yesterday , applciation ruuning fine not not working . tried find existing solr id using command lsof -i :8982 , doesn't show . deleted solr folder app & executed rake sunspot:solr:start , doesn't works me.

wordpress - How to customize the categories page in woocommerce? -

i want change layout of page per custom wordpress theme don't know file should edited customizing woocommerce categories page. you have change partly .. wordpress category comes more 1 files. have change file file , manage sequence .. files related category find in template folder of woocommerce ..

r - Filtering for only complete sets of years -

i have data on yield organized state , county. out of data want retain counties providing complete years between 1970 2000. the following code clears away incomplete cases, fails omit cases- larger data set. fake data some fake data: fake data k <- 5 # number of rows set nan df <- data.frame(state = c(rep(1, 10), rep(2, 10)), county = rep(1:4, 5), yield = 100) df[sample(1:20, k), 3] <- nan current code: df1 <- read.csv("gly2.csv",header=true) df <- data.frame(df1) droprows_1 <- function(df, v1, v2, v3, value = 'x'){ idx <- df[, v3] == value todrop <- df[idx, c(v1, v2)]; todrop # should have k rows missng todrop <- unique(todrop); todrop # unique values less nrow <- dim(todrop)[1] for(i in 1:nrow){ idx <- apply(df, 1, function(x) all(x == todrop[i, ])) df <- df[!idx, ] } return(df) } qq <- droprows_1(df, 1, 2, 3) thank you to drop county's single missing ...

javascript - How to access any file (html) one level up to localhost path in node.js? -

Image
how can access above file in image localhost:2000/dummy.html and dummy.html 1 level localhost? one way: __dirname + '../' + filename; __dirname gives path script executing from. appending ../ + filename tell node 1 level in directory path. you should @ process module in node. lot of environment data exposed through it. e.g. process.env.pwd returns current filesystem path.

javascript - Finding an object in an XML database, feeding it's info to relevant DOM elements -

apologies if title not make sense; i'm little new , not sure smartest way phrase is. i have page has row of movie posters @ top. clicking 1 of them should: open xml file ajax find object in xml file same name movie poster clicked populate "template" in page, using movie info found within xml object here example snippet of xml: <movies> <movie name="se7en"> <title>se7en</title> <quote>ernest hemingway once wrote;<br>“the world fine place , worth fighting for.”<br>i agree second part.</quote> <showing>aug 28, 3:45pm</showing> <rating>r</rating> <year>1995</year> <length>127 minutes</length> <genre>thirller</genre> <staring1>brad pitt</staring1> <staring2>morgan freeman</staring2> <staring3>gwyneth paltrow</staring3> <staring4></staring4> <slogan...

Whenever I try to exit Eclipse it asks me to "confirm poor choice" -

Image
i installed eclipse , whenever try exit prompt appear asking me "confirm poor choice" , "you're trying close problems view". i don't want close problem view , want keep don't know change setting. have check or click somewhere in settings? @nitind when "confirm poor choice" screen appears , press alt+ shift + f1 yellow box appears next "confirm poor choice" box. can't take screenshot or else "high contrast" prompt appears. took pic camera phone. @nitind whenever try press print screen while yellow box appears on screen box asks if want "turn on high contrast"? -here 2 files downloaded if info helps. "jdk-8u45-windows-i586 (1).exe" , "eclipse-windows (1).zip" i had same problem , fixed it. in case caused having stanford university plugin. go windows->preferences->stanford , turn off first checkbox (something warn closing problems view).

Converting FTP data sync to Azure services -

i have old legacy application built on .net remoting, , transferring data via xml via ftp. esentially, crm system sending xml files directory on web server, has windows service uses filewatcher process incoming xml file, updating database. similarly, changes on web application serialize down xml file out folder, crm polls via ftp every 5 minutes. trying map best services convert azure. you use azure blobs or azure files this. azure blobs : lowest cost option, while still providing high throughput. however, note azure blobs not have file watcher functionality, have poll directory every few minutes check new file. if delete files after processing them, easy - have list , see if there files. if want retain files, might have more, since file list big on time. let me know if case , can suggest options. azure files : smb share can mount vm in same region. map pretty closely exising filesystem based code, including filewatcher. however, note azure files can mounted vm in ...

javascript - AngularJS controller is being called twice -

i new in angularjs. learning angularjs. trying follow different tutorials. working codes now. have question in regard. codes ares below index.html <html ng-app="main_app"> <head> <title>angularjs application</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js"></script> <script src="js/route.js"></script> </head> <body ng-controller="main_controller"> <div ng-view></div> </body> </html> route.js var app = angular.module('main_app',['ngroute']); app.config(function($routeprovider) { $routeprovider...

excel compare current time value from sheet1 to time value range from sheet2 -

i trying compare time value sheet 1 sheet 2 , close match values in sheet1 -- b, c, d columns. whenever refresh cell should automatically update results in b, c, c, d see expected result sheet 1 show current time i.e., cell a1 "=now()" sheet1 ---------------------------------------------------- | | b | c | d | |--------------------------------------------------- | 12:55:00 | | | | ---------------------------------------------------- in sheet 2, data available in 4 columns below -------------------------------------------------------- | no | start | end | date | |------------------------------------------------------- | 1 | 07:36:00 | 08:23:10 | 15/05/2015 | | 2 | 08:23:10 | 09:10:20 | 15/05/2015 | | 3 | 09:10:20 | 09:57:30 | 15/05/2015 | | 4 | 09:57:30 | 10:44:40 | 15/05/2015 | | 5 | ...

How to aggregate in R with a custom function that uses two columns -

is possible aggregate custom function uses 2 columns return 1 column? say have dataframe: x <- c(2,4,3,1,5,7) y <- c(3,2,6,3,4,6) group <- c("a","a","a","a","b","b") data <- data.frame(group, x, y) data # group x y # 1 2 3 # 2 4 2 # 3 3 6 # 4 1 3 # 5 b 5 4 # 6 b 7 6 and have function want use on 2 columns (x , y): pathlength <- function(xy) { out <- as.matrix(dist(xy)) sum(out[row(out) - col(out) == 1]) } i tried following aggregate: out <- aggregate(cbind(x, y) ~ group, data, fun = pathlength) out <- aggregate(cbind(x, y) ~ group, data, function(x) pathlength(x)) however, calls pathlength on x , y separately instead of together, giving me: # group x y #1 5 8 #2 b 2 2 what want call pathlength on x , y , aggregate way. here want aggregate do: reala <- matrix(c(2,4,3,1,3,2,6,3), nrow=4, ncol=2) pathlength(reala) # [1] 9.964725 realb ...

How do I read JPEG and PNG pixels in C++ on Linux? -

i'm doing image processing, , i'd individually read each pixel value in jpeg , png images. in deployment scenario, awkward me use 3rd party library (as have restricted access on target computer), i'm assuming there's no standard c or c++ library reading jpeg/png... so, if know of way of not using library great, if not answers still welcome! there no standard library in c-standard read file-formats. however, programs, on linux platform use same library decode image-formats: for jpeg it's libjpeg, png it's libpng. the chances libs installed very high. http://www.libpng.org http://www.ijg.org

php - Current timestamp is different from current date -

i have table. +------------------+--------------+------+-----+-------------------+- | field | type | null | key | default | +------------------+--------------+------+-----+-------------------+- | encoded_date | timestamp | no | | current_timestamp | | actual_date | date | no | | null | +------------------+--------------+------+-----+-------------------+- my computer's date 5/14/2015 10:10am.. why when submit form, record being save encoded date: 2015-05-13 18:59:03 try setting timezone @ top of form page this: <?php //set time zone date_default_timezone_set('america/new_york'); ?> you can find whatever timezone in here: http://php.net/manual/en/timezones.php

ios - Content in UIScrollView is being cutoff early -

Image
i have several uiviews within a uiscrollview , want them scroll way bottom of uiscrollview before cutting off (see image #2). background on scroll view: i created uiscrollview subclass of custom uiview . put view in uiscrollview auto layout in storyboard creates correct frame device. in view controller attached storyboard uiviewcontroller created an iboutlet the uiview , , in viewdidappear function called function attached view populated uiscrollview . in storyboard gave view blue background tell frame. here storyboard looks like: then looks on phone: notice how space exists between view cuts off , bottom of screen is. on devices. i have tried adjusting bottom content inset. @ 0.0 tried make -20 , did not help. how can fix this?

ios - (Swift) Deleting UITableViewCell by dragging it out of the UITableView? -

i have uitableview items array in it. it's possible move position of uitableviewcell an uilongpressgesturerecognizer freely around y , x axis, want able delete dragged uitableviewcell if it's moved outside of uitableview . i'm aware i'll using switch case uigesturerecognizer.ended perform i'm @ loss on how deal it. here's code: func longpressgesturerecognized(gesturerecognizer: uigesturerecognizer) { let longpress = gesturerecognizer as! uilongpressgesturerecognizer let state = longpress.state var locationinview = longpress.locationinview(tbltasks) var indexpath = tbltasks.indexpathforrowatpoint(locationinview) struct { static var cellsnapshot: uiview? = nil } struct path { static var initialindexpath : nsindexpath? = nil } switch state { case uigesturerecognizerstate.began: if indexpath != nil { path.initialindexpath = indexpath let cell = tbltasks...

c# - Setup Nlog unc path by project configuration file -

say defined nlog target as: <variable name="day" value="${date:format=dddd}"/> <targets> <target name="file" xsi:type="file" layout="${verbose}" filename="${basedir}/${day}.log" /> </targets> however want place file location @ app config file or other xml file. don't know how set unc path in c# code programmatically rather in nlog configuration file. edit: say application distributed in 100 clients in different location in us. each client prefer own log file location. application has own app.config or respective xml file store location. seems no way hard code locations in nlog configuration file. so needed similar connection strings , db targets ( this original question , self answer , may add additional help). taking solution little modifications can try notes: 1. has not been tested should close. 2. using castle windsor why have factory class setup, dont n...

c++ - Returning a const pointer to a const data member and the 'auto' keyword. A bit confused -

i've been learning c++ , today have been introduced const , concept of const correctness. in attempt better understand theory, i've been writing series of simple programs make sure understand concept correctly. thought understood everything, when using auto keyword in 1 of programs, seem have got bit stuck. in order test understood how const pointers work wrote simple program. won't bother posting whole thing since there's 2 parts of relevant. have class const data member of type int: const int trytochangeme; within class have member function returns const pointer above const int: const int* const myclass::test() { return &trytochangeme; } in main function call above function, making use of auto keyword. in order test think know const correct attempt reassign trytochangeme variable through pointer. so: auto temp = myclass.test(); *temp = 100; as expected, program wouldn't compile due error caused when trying assign value const variabl...

regex - How do I get perl to print n lines following a specific string? -

i have large file , want pull out atom symbols , coordinates equilibrium geometry. desired information displayed below: ***** equilibrium geometry located ***** coordinates of atoms (angs) atom charge x y z ----------------------------------------------------------- c 6.0 0.8438492825 -2.0554543742 0.8601734285 c 6.0 1.7887997955 -1.2651150894 0.4121141006 n 7.0 1.3006136046 0.0934593194 0.2602148346 note: after coordinates finish there blank line. i have so-far patched code makes sense me produces errors , not sure why. expects 1 file after calling on script, saves each line , changes $start==1 when sees string containing equilibrium geometry triggers recording of symbols , coordinates. continues save lines contain coordinate format until sees blank line finishes recording $geom. #!/usr/bin/perl $num_args = $#argv + 1; if ($num_args != 1) {    print "\nmust s...

c++ - Add BASS library in Code::Blocks on Linux -

can me adding bass library in code::blocks on ubuntu? step step. tried many things , can't this... have "bass24-linux.zip" file , now? please me possible! edit: i tell im doing: unzipping "bass24-linux.zip" on desktop. copying "bass.h" /usr/include copying "libbass.so" /usr/lib in code blocks going settings->compiler->search directories setting compiler path /usr/include (where bass.h is) setting linker path /usr/lib (where libbass.so is) then going project build options->linker settings , set path ../../../../../usr/lib/libbass.so; then i'm writing simple program, example: #include <iostream> int main(){ } and see error: g++ -l/usr/lib -o bin/debug/lightbulb obj/debug/main.o ../../../../../usr/lib/libbass.so ../../../../../usr/lib/libbass.so: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status

django - Extending form.is_valid() -

i learning django, , stumbled upon need with: forms.py class userform(forms.modelform): password1 = forms.charfield(widget=forms.passwordinput()) password2 = forms.charfield(widget=forms.passwordinput()) class meta: model = user fields = ('username', 'email', 'password1','password2') def password_matched(self): if self.data['password1'] != self.data['password2']: self.errors['password'] = 'passwords not match' return false else: return true def is_valid(self): valid = super(userform,self).is_valid() password_matched = self.password_matched() if valid , password_matched: return true else: return false views.py def register(request): #blah... user.set_password(user.password) # user.set_password(user.password1) doesn't work ! why!? so basically, che...

android - convert List<ApplicationInfo> to String[ ] -

i need convert list string[ ]. how that? i tried that: packagemanager packagemanager = getpackagemanager(); list<applicationinfo> liste_aller_anwendungen = packagemanager.getinstalledapplications(packagemanager.get_meta_data); string[] strings = liste_aller_anwendungen.toarray(new string[liste_aller_anwendungen.size()]); but produces following logcat errors: java.lang.arraystoreexception: source[0] of type android.content.pm.applicationinfo cannot stored in destination array of type java.lang.string[] @ java.lang.system.arraycopy(native method) @ java.util.arraylist.toarray(arraylist.java:523) @ de.gestureanywhere.hintergrundservice.ongestureperformed(hintergrundservice.java:152) @ android.gesture.gestureoverlayview.fireongestureperformed(gestureoverlayview.java:729) @ android.gesture.gestureoverlayview.access$400(gestureoverlayview.java:55) @ android.gesture.gestureoverlayview$fadeoutrunnable.run(gestureoverla...

android - NullPointerException Error while using AsyncTask in onActivityResult -

i want select image gallery , crop it,then upload image server.if upload success,change view,if upload fail,them give message; i use onactivityresult manage this,and use asynctask make http post, dismiss progressdialog,and save image,then ran error java.lang.runtimeexception: failure delivering result resultinfo... and caused by caused by: java.lang.nullpointerexception in asynctask codes; here button crop avatarbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(intent.action_pick); intent.settype("image/*"); startactivityforresult(intent,1); } }); and onactivityresult code @override protected void onactivityresult(int requestcode, int resultcode, intent data) { switch (requestcode){ case 1: if (data != null) { uri uri = data.getdata(); crop(uri); ...

Using R to Compare Dates -

i've got 2 csv files. one file lists when , why employee leaves. employeeid,department,separation_type,separation_date,fyfq 119549,sales,retirement,09/30/2013 2629053,sales,termination,09/30/2013 120395,sales,retirement,11/01/2013 122450,sales,transfer,11/30/2013 123962,sales,transfer,11/30/2013 1041054,sales,resignation,12/01/2013 990962,sales,retirement,12/14/2013 135396,sales,retirement,01/11/2014 another file lookup table shows start , end dates of every fiscal quarter: fyfq,start,end fy2014fq1,10/1/2013,12/31/2013 fy2014fq2,1/1/2014,3/31/2014 fy2014fq3,4/1/2014,6/30/2014 fy2014fq4,7/1/2014,9/30/2014 fy2015fq1,10/1/2014,12/31/2014 fy2015fq2,1/1/2015,3/31/2015 i'd r find fyfq separation_date occurred in , print fourth column in data. input: separations.csv: >employeeid,department,separation_type,separation_date,fyfq >990962,sales,retirement,12/14/2013 >135396,sales,retirement,01/11/2014 fi...

.htaccess - htaccess — redirect to www and catch all index.php -

i'm new htaccess, apologies in advance. i'm trying redirect non-www www. far good. @ same time i'm trying catch , clean link ("index.php" not shown) index.php. i tried combine following lines, didn't succeed in make htaccess work properly: rewritecond %{http_host} !^www\. rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [qsa] it redirects non-www www , doesn't show "index.php". want keep full url. example: example.com/subfolder should link www.example.com/subfolder show index.php thanks help! i (hopefully) answered own question trial , error. rewritecond %{http_host} !^www.example.com$ [nc] rewriterule ^(.*)$ http://www.example.com/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^?]*)$ /index.php?path=$1 [nc,l,qsa] of course rewriteengine on

c# - NHibernate Get Data from composite key with reference key does not work -

i have class public class clsmovimientosmodel { public virtual datetime fecha_etmv { get; set; } public virtual clsequipotransportemodel equipt_etmv { get; set; } public virtual string tmov_etmv { get; set; } public virtual string observ_etmv { get; set; } public virtual string usr_etmv { get; set; } } and map class public class clsmovimientosmap : classmap<clsmovimientosmodel> { public clsmovimientosmap() { table("et_movimientos"); compositeid() .keyproperty(p => p.fecha_etmv, "fecha_etmv") .keyreference(p => p.equipt_etmv, "id_etmv"); map(m => m.tipo, "tipo_etmv").length(2).not.nullable(); map(m => m.tmov_etmv, "tmov_etmv").length(1).not.nullable(); map(m => m.observ_etmv, "observ_etmv").length(2000).not.nullable(); map(m => m.usr_etmv, "usr_etmv").length(10).not.nullable(); } } ...

Same file descriptor after fork() -

i'm trying understand means duplicating file descriptor after calling fork() , possible effects on contention. in "the linux programming interface" 24.2.1 (p517): when fork() performed, child receives duplicates of of parent's file descriptors. these duplicates made in manner of dup(), means corresponding descriptors in parent , child refer same open file description. when run same code: #include <unistd.h> #include <fcntl.h> #include <stdio.h> #include <sys/wait.h> int main(void) { char* fl = "/tmp/test_fd"; int fd; fd = open(fl, o_creat|o_trunc|o_wronly, 0666); if(!fork()) { printf("cfd=%d\n", fd); _exit(0); } else { int status; printf("ffd=%d\n", fd); wait(&status); close(fd); unlink(fl); } } i same file descriptor (number?) both processes: ffd=3 , cfd=3. when run code using dup(): #include <unistd.h...

php - How To Cast Eloquent Pivot Parameters? -

i have following eloquent models relationships: class lead extends model { public function contacts() { return $this->belongstomany('app\contact') ->withpivot('is_primary'); } } class contact extends model { public function leads() { return $this->belongstomany('app\lead') ->withpivot('is_primary'); } } the pivot table contains additional param ( is_primary ) marks relationship primary. currently, see returns when query contact: { "id": 565, "leads": [ { "id": 349, "pivot": { "contact_id": "565", "lead_id": "349", "is_primary": "0" } } ] } is there way cast is_primary in boolean? i've tried adding $casts array of both models did not change any...

python - Scipy.optimize.minimize giving error when passed a single parameter with args -

given following values a = 100.0 b = 50.0 c = 200.0 the following code works (it doesn't interesting) def excessrevenue1(taxh,blah1,blah2): return taxh**2 + blah1 + blah2 print optimize.minimize( excessrevenue1,c,args=(a,b) ).x but following code produces error << typeerror: can concatenate tuple (not "float") tuple >>. difference seems passing 1 argument instead of two. def excessrevenue2(taxh,blah1): return taxh**2 + blah1 print optimize.minimize( excessrevenue2,c,args=(a) ).x right python thinks args argument float, not tuple have add comma. print optimize.minimize( excessrevenue2,c,args=(a,)).x so then, function work expected, i.e.: from scipy import optimize = 100.0 b = 50.0 c = 199.9 def excessrevenue1(taxh,blah1,blah2): return taxh**2 + blah1 + blah2 def excessrevenue2(taxh,blah1): return taxh**2 + blah1 print optimize.minimize( excessrevenue2,c,args=(a,)).x print optimize.minimize(excessrevenue1,c,a...

javascript - Dropzone.js - drop outlook emails -

we have dropzone set in our browser application , works great! however, trying find way drag , drop emails ms outlook , have not had success. there way this? you cannot unless override idroptarget interface of browser. see upload fails when user drags , drops attachment email client

bash - remove the first 15 characters from every other line in a file -

i have txt files (they contain dna sequences , sample codes): >srr1502445.1 gactacacgtagtatacgagtgcgttcctgcgcttattgatatgcttaagttcagcgggtagtctcacccgatttgaggtcaaggtttgtgggtcgagtcacaactcgaacatcgtctttgtacaaagacggttggaagcgggttccaaggcaacacagggggataggnnnnnnnnnnnnnnnnnnnnnnn >srr1502445.2 gactacacgtagtatacgagtgcgttcctgcgcttattgatatgcttaagttcagcgggtagtctcacccgatttgaggtcaaggtttgtgggtcgagtcacaactcgaacatcgtctttgtacaagacggttggaagcgggttccaaggcacacaggggataggnnn >srr1502445.3 gactacacgtagtatacgagtgcgttcctgcgcttattgatatgcttaagttcagcgggtagtctcacccgatttgaggtcaaggtttgtgggtcgagtcacaactcgaacatcgtctttgtacaaagacggttggaagcgggttccaaggcacacaggggataggnnn >srr1502445.4 gactacacgtagtatacgagtgcgttcctgcgcttattgatatgcttaagttcagcgggtagtctcacccgatttgaggtcaaggtttgtgggtcgagtcacaactcgaacatcgtctttgtacaaagacggttggaagcgggttccaaggcacacaggggataggnnnnnnnnnnn i remove first 15 characters of every other line in file. remove string gactacacgtagtat second, fourth, sixth, eighth lines (etc). for instance cut co...

c# - Given an unzoned DateTime and a timezone, how can I construct an instant in NodaTime? -

i have datetime constructed explicitly. var mydatetime = new datetime(2015,1,1,0,0,0); i have timezone obtained explicitly. var mytimezone = datetimezoneproviders.tzdb["america/los_angeles"]; mydate known represented in mytimezone how should use information generate zoneddatetime or instant using nodatime? first, convert datetime localdatetime . localdatetime ldt = localdatetime.fromdatetime(mydatetime); then can assign zone: zoneddatetime zdt = ldt.inzoneleniently(mytimezone); and map instant: instant instant = zdt.toinstant();

ios - Make a UIButton inactive if no text is entered in a TextField in Swift -

so concept simple, have textfield , button labelled 'next'. next button disabled users if have not put in textfield. this, have run code: @ibaction func nextbutton(sender: uibutton) { if textfield.text.isempty { buttonlabel.userinteractionenabled = false } } this disables button want, problem is, if text entered in textfield, button still disabled. have tried adding "else" statement after "if" statement reverse i'm saying see if works, doesn't. any appreciated. nick my code: import uikit class viewcontroller: uiviewcontroller, uitextfielddelegate, uipickerviewdatasource, uipickerviewdelegate { func imageeffect() { // set vertical effect background var verticalmotioneffect : uiinterpolatingmotioneffect = uiinterpolatingmotioneffect(keypath: "center.y", type: .tiltalongverticalaxis) verticalmotioneffect.minimumrelativevalue = -20 verticalmotioneffect.maximumrelativevalue = 20...

html - set max-height of flexbox sidebar to never exceed the other box -

i've flex layout 2 columns: 1 sidebar , 1 content . i need way make sidebar height never higher height of box-content. my css is: .layout { display: flex; } .sidebar { } .content { flex: 1; } http://codepen.io/fezvrasta/pen/wvwzxo how can do? found solution: http://dcousineau.com/blog/2011/07/14/flex-box-prevent-children-from-stretching/ you have put div inside sidebar , set height 0 , make trick.

python - Indexing tensor with binary matrix in numpy -

i have tensor such a.shape = (32, 19, 2) , binary matrix b such b.shape = (32, 19). there one-line operation can perform matrix c, c.shape = (32, 19) , c(i,j) = a[i, j, b[i,j]]? essentially, want use b indexing matrix, if b[i,j] = 1 take a[i,j,1] form c(i,j). np.where rescue. it's same principle mtrw's answer: in [344]: a=np.arange(4*3*2).reshape(4,3,2) in [345]: b=np.zeros((4,3),dtype=int) in [346]: b[[0,1,1,2,3],[0,0,1,2,2]]=1 in [347]: b out[347]: array([[1, 0, 0], [1, 1, 0], [0, 0, 1], [0, 0, 1]]) in [348]: np.where(b,a[:,:,1],a[:,:,0]) out[348]: array([[ 1, 2, 4], [ 7, 9, 10], [12, 14, 17], [18, 20, 23]]) np.choose can used if last dimension larger 2 (but smaller 32). ( choose operates on list or 1st dimension, hence rollaxis . in [360]: np.choose(b,np.rollaxis(a,2)) out[360]: array([[ 1, 2, 4], [ 7, 9, 10], [12, 14, 17], [18, 20, 23]]) b can used directly index. tric...

sql - Is it possible to create a table that updates its contents from a view once a day? -

given view collects large amount of data , reduce server's performance if run frequently. possible create sort of table takes results view , sort of scheduling once day? other queries take information table , not view? that materialised view, may regarded combination of: a predefined query a table storing results of query metadata concerning frequency , type of refresh subject metadata concerning other items, such whether queries against objects own query references may rewritten address materialised view if calculated more efficient. they used forms of replication. see http://docs.oracle.com/cd/e11882_01/server.112/e10706/repmview.htm#repln265 , http://docs.oracle.com/cd/e11882_01/server.112/e25554/basicmv.htm#dwhsg0081

python - Ensure that process started by COM connection is killed -

i'm automating minitab 17 using python's win32com library, , while of commands execute correctly, can't seem process started minitab process exit when script ends. structure looks like from myapi import get_data import pythoncom win32com.client import gencache def process_data(data): # in case of threading pythoncom.coinitialize() app = gencache.ensuredispatch('mtb.application') try: # processing pass finally: # app-specific command supposed close software app.quit() # ensure object released del mtb # in case of threading pythoncom.couninitialize() def main(): data = get_data() process_data(data) if __name__ == '__main__': main() i don't exceptions raised or error messages printed, mtb.exe process still listed in task manager. more frustrating if run following in ipython session: >>> win32com.client import gencache >>> app =...

How to get Python to not encode my urls -

i've got simple script opens uri in appropriate application. it's not web browser (not http). i've been using webbrowser , opens in right application, url encodes everything, frustrating. there's easy way see problem, trying open google search: webbrowser.open('https://www.google.com/#q=sdfs dfs') this breaks because try's open: https://www.google.com/%23q=sdfs%20dfs and google returns error. i've been trying figure out how turn off url encoding, haven't turned anything. i'm not married webbrowser , whatever is, it'd need able open different url types, urllib doesn't: urllib2.urlerror: <urlopen error unknown url type: jjur> thoughts?

javascript - AngularJS + MEANJS - Use object model property as array key for filter -

i have meanjs app crud module of countries. when click on country default list view, brings me view-country.client.view. have added field model currencycode. when click country bring me page want bring exchange rate json matching currencycode field of country model data json import. //view-country.client.view <section data-ng-controller="countriescontroller" data-ng-init="findrate()"> <div class="col-lg-3 col-md-6 col-sm-12"> <div class="panel panel-dark"> <div class="panel-heading">currency</div> <div class="panel-body"> {{country.currencycode}} <p>the exchange rate {{exchangerates.rates['afn']}} </div> </div> </div> </section> //findrate() data-ng-init in countriescontroller $scope.findrate = function() { $scope.country = countries.get({ coun...

BigCommerce, How to add a custom quick view button -

bigcommerce, how add custom quick view button anywhere other 1 shows on hover in code? <div class="productimage quickview" data-product="%%global_productid%%"> %%global_productthumb%% </div> it's been 4 months since original post i'm not sure if need anymore, others might find useful. in categoryproductsitem.html can insert following code <style>.quickview.yourclass .quickviewbtn{background-color:transparent !important;} .quickview.yourclass{position:relative; display:block; padding:0;}</style><div class="quickview yourclass btn small icon-add cart" data-product="%%global_productid%%" style="display:block !important; visibility: visible;">add cart</div> i use give customer ability change quantities in add cart popup(which using quick view one). quickviewcontent.html add in product description if wanted %%global_quickviewproductdescription%% the visibility , blo...

spring security - Authentication against a web service without involving Grails domains -

i have legacy database app , have add app common sign in user table related sign in not accessible, have access app gives json output login authentication. for i'm trying use spring security plugin not able figure out entry point of url , how redirect input login page url. thank above answers helped me alot along objectpartners.com customize spring security plugin https://objectpartners.com/2013/07/11/custom-authentication-with-the-grails-spring-security-core-plugin/ https://github.com/jacobaseverson/smart-notes