Posts

Showing posts from September, 2010

python - Theano + Windows + CUDA, work well using CMD, but encoutered error in eclipse (warning C4819) -

Image
i working ` windows + cuda 6.5 + vs2010 + python2.7 + theano. python scripts works when using command line, say: python ddi_convnet.py and results as: however, when run same python scripts in eclipse , lot of errors: i think due difference of character map of eclipse , cmd , because warning c4819 implies lot of .h files not parsed correctly. how fix it? i find answer myself. because, installed microsoft c++ python first, , installed vs2010. environment variable of eclipse can updated after restarting windows. however, after restart windows, problem changes, not warning c4819 more, began report errors "unresolved external ...", due dlls or libs not included correctly eclipse. finally, decide change ide pycharm. goes far.

How to apply embedded css in html email? -

i want apply embedded css in html email page. when doing css not applying html email when trying send email using html page. solution enable css visibility in email when send html page email ? the best approach inline css rather use <style> tag it's not heavily supported. html/css in email can difficult thing due fluctuation of support in email clients. this list helpful checking out supported , guide along way.

ajax - jquery serialize multiple checkboxes with same name -

i have searched , searched cannot find answer fit exact situation. hoping can help. i trying "retrofit" site using frames use ajax , divs now. going well, except... this site has multiple forms. trying write jquery code handle forms (using ajax of course). therefore, using id selectors , out. real problem comes in when using serialize() handle multiple checkboxes same name. consider following scenario: html <form name="theform" method="post" action="form.cgi"> <input type="hidden" name="directory" value="test"> <input type="checkbox" name="file" value="file1.txt"> <input type="checkbox" name="file" value="file2.txt"> ... <input type="checkbox" name="file" value="file10.txt"> <input type="submit" name="submit" value="submit"> </form> jquery

SSIS Multiple Hash causing error on server -

Image
i have installed ssis multiple hash on machine, , using build ssis packages. once deployed following error message when execute: the component metadata "multiple hash, clsid {33d831de-5dcf-48f0-b431-4d327b9e785d}" not upgraded newer version of component. performupgrade method failed. component missing, not registered, not upgradeable, or missing required interfaces. contact information component "http://ssismhash.codeplex.com/". any ideas? using: microsoft visual studio community 2013 development the ssis pakcage deployed on: microsoft sql server 2014 - 12.0.2000.8 (x64) feb 20 2014 20:04:26 copyright (c) microsoft corporation standard edition (64-bit) on windows nt 6.3 (build 9600: ) (hypervisor) a bit late in case else has same problem: check under control panel\programs\programs , features on server want run package multiplehash component installed: if not install ( multiplehash download ). once has been done can valid

java - Efficiently Adding Filters to Spring Repository Methods -

i have list of spring repository methods has grown more , more users request additional filters. i.e., these 5 example methods out of 20 have: public interface managerrepository extends repository<manager, long> { list<manager> findmanagerbyname(long id); list<manager> findmanagerbynameandprojects(long id, string project) list<manager> findmanagerbynameandpojectlike(long id, string project) list<manager> findmanagerbynameandpojectstartswith(long id, string project) list<manager> findmanagerbynameandprojectlikeandemployeeslike(long id, string project, string employeename } the # of filters seemingly endless new requirements, , don't think i'm utilizing spring repositories correctly in fashion. how can handle additional filters without creating new methods (as current methods might duplicated if want create another search crazy like: findmanagerbynamestartswithascandprojectslikeignorecaseandmonthstarted (string na

Mongodb aggregate to find if a user is in any other user's follower list -

i collected followers list , friends list n number of users twitter , stored them in mongodb. here sample document: { "_id": objectid("561d6f8986a0ea57e51ec95c"), "status": "true", "userid": "1489245878", "followers": [ "1566382441", "1155774331" ], "followerscount": 2, "friendscount": 5, "friends": [ "1135511478", "998082481", "565321118", "848123988", "343334562" ] } i wanted know within collection, there userids in followers list of other documents. lets have user "a", know if user "a" in followers list of other document within same collection. i'm not sure how this. in case if have, project userid , _id of document has userid within followers list. i guess can use aggregate function below result. db.getcollection('your_co

javascript - Exclude images from lightbox in "Photo Swipe Masonry" -

i using "photo swipe masonry" plugin (version 1.0.6) on wordpress 4.3.1. works perfect far. but, have images have custom link external url(instead of stadard image). if click 1 of these images, opens url in new window. works expected. now, when click on standard image( no external url ), lightbox opens , image displayed expected. but now, when use prev/next buttons navigate through images , reach image custom link , got errormessage: " the image not loaded" (in lightbox). so, question is, how exclude images being added lightbox ? maybe unique class ? any highly appreciated. many in advance of time. regards, joe i'm developer of plugin. sorry missing post. there no function built in sorry. need edit photoswipe code.

arrays - Performance Considerations when using VBA Filter Function -

Image
i can't figure out how filter function works fast. have used filter on sorts of data , regardless of data-type, filter obliterates alternative method employ. regularly use binary search algorithm , quickarraysort algorithm written stephen bullen (found in professional excel development ). binary search lightning fast (as fast filter function, given array sorted) , quick sort algorithm 1 of fastest sorting algorithms known. i have written test code below comparing speeds of finding random element in large array (size = 2,000,000). intentionally populate array in un-ordered fashion (it should noted have tried various un-ordered assigning methods, , results similar regardless of assigning method). sub searchtest() dim long, strmyarray() string, lngsize long, strtest string dim timebinarysearch long, timefiltersearch long dim lngresultbinary long, lngresultfilter long dim starthour long, startminute long, startsecond long dim startmilisecond long, starttime long dim endh

ios - Objective C ternary operator vs if statements nil check -

im checking see if array nil , if want set counter variable 0 , length of array if array not nil. nsuinteger count = 0; if (self.somearray == nil) { count = 0; } else { count = self.somearray.count; } and works fine expected. when try this: nsuinteger count = (self.somearray == nil) ? 0 : self.somearray.count i [nsnull count] unrecognized selector error. however, when this ([self.somearray iskindofclass:[nsnull class]]) ? 0 : self.somearray.count` it seems latter should work me there simple overlooking? nsnull objects nil right? why simple nil check working in if statement , not in ternary operator? self.somearray nsnull object, not nsarray object. i suspect got object json message , haven't checked type before storing in class. once have sorted; works if array set or not: nsuinteger count = self.somearray.count;

STI and Polymorphic Association possible in rails 4? Not working for me -

i'm of newbie ruby on rails , went off of samurails.com single table inheritance rails 4 tutorial add different comment types. worked great problem i'm running when try use polymorphic associations comments , specific type function under other models such project , challenge. regular comment works, specific types not. i haven't seen says how make work or option of going appreciated. class comment < activerecord::base has_merit acts_as_votable belongs_to :commentable, :polymorphic => true belongs_to :user belongs_to :commenttype belongs_to :project def self.types %w(question idea problem) end def commentable_type=(stype) super(stype.to_s.classify.constantize.base_class.to_s) end scope :questions, -> {where(type: 'question')} scope :ideas, -> {where(type: 'idea')} scope :problems, -> {where(type: 'problem')} end class question < comment end class idea < comment end class problem

documentation - How to read Node.js API docs? What does e.g. "stat(2)" mean? -

for example, let's consider file system module , fs.stat(path, callback) method. here description: fs.stat(path, callback) asynchronous stat(2). callback gets 2 arguments (err, stats) stats fs.stats object. see fs.stats section below more information. what stat(2) mean? not link, doesn't follow anywhere, string. how understand it? api documentation has gazillion of such references, mean? stat(2) reference stat() function in specific posix revision level (which believe posix.1-2001 , referred susv3). see man page stat(2) here . the node.js documentation pretty assumes familiar parts of posix library , not offer helpful references not familiar (which unfortunate in opinion).

html - Less version of bootstrap 3.2.0? -

this question has answer here: where find twitter bootstrap less files? 2 answers i need less/sass version of bootstrap version 3.2.0 old site - can that? i tried using current version, apparently not support jumbotron, , glyphicons.. take here https://github.com/twbs/bootstrap/releases/tag/v3.2.0 - shows changes , such https://bootstrapdocs.com versions released @ time. this full release 3.2.0 you can download full source , less in there. hope helps!

html table - JQuery delete rows allow a maximum of totalrows-1 -

i have dynamic table add , delete functions in jquery: i deleting rows using following: $("#del").click(function(){ $("table tr input:checked").parents('tr').remove(); }); fiddle: fiddle how can avoid deleting columns in same time. mean if user checked rows , click delete, should show alert message. should allow delete maximum of totalrows-1 you can use jquery's size() function count number of rows checked inputs , compare total number of rows. $("#del").click(function(){ var checked = $("table tr input:checked").size(); var total = $("table tr").size(); if (checked < total) { $("table tr input:checked").parents('tr').remove(); } else { alert("you cannot delete rows!"); } }); see updated fiddle here .

asp.net - OAuth : How to get email address from external provider (GitHub)? -

Image
users on website can authenticated through external providers such github. process working after call request.getowincontext().authentication.challenge(properties, authenticationprovider) but 1 point github doesn't return email address. after call above, generates authorize url scope=user . maybe point. think should work if scope=user,user:email mentioned there i tried add parameters properties no luck. can me on this, please? but 1 point github doesn't return email address. this might affected user's settings on github. there option settings / profile / public email , if user chooses public email visible app bellow claim #3

How do I access Ember.js API documentation? -

i'm using older version of ember (two older versions in fact) , i'd view api docs version that's older 2.x, versions i'm using ember v1.12.0 , v1.10.0. i know how access older guides using dropdown menu there's no menu api docs. is there way online or can generate api docs locally particular versions of ember? there exists ember app browsing api docs, has installed , run locally: https://github.com/emberjs/api there option of using devdocs.io web app api documentation browsing or zeal offline viewer linux , windows.

html - Avoid page scrolling on a div - AngularJS -

in website, want integrate animation 3d (already done) has zoom option. when on image (mouseover) , scroll zoom scroll entire page. this animation integrated following way : <iframe id="myanimation" src="http://myanimation..." scrolling="no" content="user-scalable=no;"></iframe> a lot of solutions have been given in javascript or jquery angularjs way that. i have thought wrapping iframe in div should have avoided scrolling entire page: <div ng-mouseenter="$window.body.scrolling='no';" ng-mouseleave="$window.body.scrolling='yes';"> or css property overflow : <div ng-mouseenter="$windiw.body.style.overflow='hidden';" ng-mouseleave="$windiw.body.style.overflow='auto';"> is there way of doing css or should think writing code avoid behaviour? thank answers.

OOP - is it better to pass big controller objects to children, or have children dispatch events? -

i'm experienced programmer, i've struggled particular issue.. have main class maybe displays pop-ups on else, transitions between screens , forth, , have screen objects themselves, , pop-up objects. when click "close" on pop-up, or click "go new screen" on screen, or whatever may be, these objects need communicate main class , tell stuff. , need pass data main class aswell. in experience work out better have children dispatch events data, main class picks up, or somehow pass main class down children through constructors, , have bunch of public methods in main class children can call? or both equally valid? edit: , also, made me post this: in game, user goes through bunch of different menu screens, , in each screen, adds game-config object @ end used generate gamescreen. dont want keep saying dispatchevent("addvaluetogameconfig", value) or something, want bigcontroller.gameconfig.value = "whatever"; if hierarchy of children

javascript - why my database cannot connect ? but this is my connect.php -

Image
<?php mysql_connect($localhost, $loyopcom_okeball, $loyopcom_okeball) or die("cannot connect"); $result = mysql_select_db($loyopcom_okeball) or die("cannot select db"); ?> try use $link =mysql_connect($localhost, $loyopcom_okeball, $loyopcom_okeball) or die("cannot connect"); and mysql_select_db('database_name', $link); besides, if use version higher 5.0,because server closed, should use mysqli_connect($localhost, $loyopcom_okeball, $loyopcom_okeball); mysqli_select_db($link,'database_name');

How to make all the contents in the android page scoll up -

in android application page have use slider, textview , gridview display images. problem when scroll up, gridview images scrolls , rest of things stays static. please me how can make contents of page move scroll? <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >`enter code here` <viewflipper android:id="@+id/viewflipper1" android:layout_width="match_parent" android:layout_height="wrap_content" > <imageview android:layout_width="fill_parent" android:layout_height="150dp" android:src="@drawable/one" /> <imageview android:layout_width="fill_parent" android:layout_height="150dp" android:src=

How to specify team/organization permissions for Trello API token? -

i can request token user visiting following url: https://trello.com/1/connect?key=<key>&name=appname&response_type=token&scope=read,write&expiration=never however, when request token's info through api, response looks this: { "id": "...", "identifier": "appname", "idmember": "...", "datecreated": "2015-10-15t05:21:19.886z", "dateexpires": null, "permissions": [ { "idmodel": "*", "modeltype": "board", "read": true, "write": true }, { "idmodel": "*", "modeltype": "organization", "read": true, "write": true } ] } i'd able request token grant privileges specific organization. can

php - How to edit CGI script website files as a user? -

this hypothetical question. let's have website built using cgi scripts. find folder within (for ex; www.website.com/links/link.txt) , has basic text files. when enter url on browser, able see file "link.txt". know website running on apache tomcat. my question is, how (as user) edit link.txt file? tools should use? unless have web-based editor can't edit files directly; security purposes if can change file means else can too. you need way either connect server , edit using remote session, or need edit file using computer , upload it. unfortunately have mentioned ssh , ftp aren't working, 2 ways have otherwise suggested. i suggest in touch site host , ask them functionality provide allow edit files. hope helps!

java - What's wrong with that JPA query, need to find a user by specific name -

i have method search name, when user passes parameter. need method tell me what's employee's role in company the idea take data , insert combobox. this method used find names passes parameter: public list<user> findbyname(string name) { entitymanager em = getentitymanager(); string sql = "select u user u upper(u.name) upper ('" + name + "%')"; list<user> u = null; try { u = (list<user> ) em.createquery(sql).getresultlist(); } catch (exception e) { return null; } return u; } and here method im trying do: public list<user> findbyrole(){ entitymanager em = getentitymanager(); string sql = "select u user u upper(u.role) (journalist)"; list<user> u = null; try { u = (list<user> ) em.createquery(sql).getresultlist(); } catch (exception e) { return null; } return u; }

git - Switch Branches of Subdirectories -

from parent directory want switch branches of subdirectories. there command this? parentdirectory - sub1 - sub2 - sub3 cd sub1 git checkout f1 cd .. cd sub2 git checkout f1 cd .. cd sub3 git checkout f1 cd .. if you're using bash, top level directory for d in */ ; git checkout "$d" done if you're using windows cmd: for /d %g in (*) git checkout %g

javascript - Android - save value on LocalStorage before WebView.loadUrl() -

before load url on webview want set value inside browser localstorage. till way did managed set value after page loaded. how can set value: browser.setwebviewclient(new webviewclient() { @override public void onpagefinished(webview view, string url) { loadurl("javascript: localstorage.set('namespace', 'key', 'value');"); } } i did try override method onpagestarted() , value not stored. how can set key/value before call browser.loadurl() ? url/page depends on value, need set value before load page. what can set redirect javascript actual url , load javascript plus redirect using webview.loaddata() . string injection = "<html><head><script type='javascript'>localstorage.set('namespace', 'key', 'value');window.location.replace('your_url_here');</script></head><body></body></html>"; webview.loa

Android Multilevel Expandableview like Google fit. -

Image
i want design listview google fit shows data. first thing comes mind using expandablelistview. google fit provides nested expandablelistview , smooth transition of expanding , collapsing. any pointers on how start design? how should layout like? should done in order provide smooth expansion , collapse? p.s. : interested in designing listview , not stuff progressbar. u can have @ this link multilevel expandable listview. also same purpose on github can @ this repository. these 2 links clarifies multilevel thing. and smooth transition see this a perfect blend of these 3 provide desired design. luck

ios - How to get all contact sort order(First,Last or Last,Fast) as iPhone in Swift 2.0 + Xcode +iPhone -

i need contact same order of iphone contact. some person selected first, last, or other selected last, first need same order iphone device setting. how possible abaddressbookcopyarrayofallpeople? does 1 me here?

How to reorder list in Python to avoid repeating elements? -

i trying check if list has consecutive repeating elements and then reorder such repeats avoided. if impossible, return false. example: checkrepeat([1,2]) out[61]: [1, 2] checkrepeat([1,2,2]) out[62]: [2, 1, 2] checkrepeat([1,2,2,1,1]) out[63]: [1, 2, 1, 2, 1] checkrepeat([1,2,2,1,1,3,3,3,3]) out[64]: [1, 3, 1, 3, 2, 1, 3, 2, 3] checkrepeat([1,2,2,1,1,3,3,3,3,3]) out[65]: [3, 1, 3, 2, 3, 1, 3, 1, 3, 2] checkrepeat([1,2,2,1,1,3,3,3,3,3,3]) out[66]: [3, 1, 3, 1, 3, 1, 3, 2, 3, 2, 3] checkrepeat([1,2,2,1,1,3,3,3,3,3,3,3]) out[67]: false here have. there more elegant solution? from itertools import groupby def checkrepeat(lst,maxiter=1000): """returns list has no repeating elements. try max of 1000 iterations default , return false if such list can't found""" def hasrepeat(lst): """returns true if there repeats""" return len([x[0] x in groupby(lst)]) < len(lst) offset=numiter=0

sql server - How to store record before it updated? -

i use sql server database. have 2 tables inspections , history_inspections . before record inspections table updated, need store history_inspections table. i wanted use sql server update trigger fired after record updated. any idea how can store record inspections table in history_inspections table before updated ? when after update trigger in sql server fires, inserted pseudo table inside trigger contains new values (after update ), , deleted pseudo table contains old values ( before update ). so in case, read out rows deleted table , store history_inspections table. create trigger trg_afterupdateinspections on dbo.inspections after update insert dbo.history_inspections(list of columns) select (list of columns) deleted

How to create a counter within a counter using verilog? -

for project, need write values address display on screen. means need 2 counters, 1 row value , 1 column value. usually, when work java, use nested loops. in verilog, logic isn't going work well. figure out how put counter inside of counter? a set of nested counters can implemented instead series of counters. have first counter increment usual. then, value of first counter (perhaps when loops 0), increment second counter. (i.e. [0,m-1] -> [1,0], first counter ranges {0,m-1})

api - Expand Query Azure Mobile Services to children of children -

i've been able use expand attribute in c# api azure mobile services expand child object , works great. however, child object has child object, want able use when getting top level item. that is, i'm querying table items, has property "subcategory", subcategory object has property "parentcategory". i want able populate objects 2 levels down, seems $expand query work on direct properties of table being queried. is there way want? i'm wanting when show list of items, show both subcategory , parent category in table. right now, can see subcategory, parent property of subcategory null. i thought perhaps adding parentcategoryid , parentcategory objects dataobject definitions, seems incorrect, since have maintain integrity manually, instead of letting link via subcategory property... any ideas? it sounds need recursive query, handled common table expressions. way create view within sql has parentcategory , subcategory every item. sear

python - Login function in separate file using RoboBrowser -

i writing program/script retrieve key information hoovers.com. have 2 files. 1 hoovers5.py (which contains, among other things, classes) , other main.py . hoovers5.py : def testlogin(): import hlogin # file contains hoovers login credentials robobrowser import robobrowser browser = robobrowser() login_url = "https://subscriber.hoovers.com/h/login/login.html" browser.open(login_url) form = browser.get_form(id='loginform') # gets login form id form['j_username'].value = hlogin._hname # fills in hoovers login name form['j_password'].value = hlogin._hpass # fills in hoovers password browser.submit_form(form) # submits login main.py : import hoovers hv5 robobrowser import robobrowser hv5.testlogin() browser = robobrowser() browser.open('http://subscriber.hoovers.com/h/company360/overview.htmlcompanyid=26082233') print browser.parsed i have tested code numerous times , login works if run login

node.js - Bamboo errors when running batch file, but I can run it manually fine -

i have batch file following contents: @echo on echo "start" echo "${bamboo.agentworkingdirectory}" call "c:\program files (x86)\microsoft visual studio 11.0\common7\tools\vsdevcmd.bat" cd "${bamboo.build.working.directory}/server" call npm install --msvs_version=2012 exit i use batch file install oracledb via bamboo. when run batch file manually, installs fine , happy. however, when bamboo run exact same batch file, following error: build 15-oct-2015 16:53:04 e:\bamboo-agent-home\xml-data\build-dir\ec-ecb-be\server\node_modules\oracledb>if not defined npm_config_node_gyp (node "c:\program files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) build 15-oct-2015 16:53:06 building projects in solution 1 @ time. enable parallel build, please add "/m" switch. build 15-oct-2015 16:53:06 njsoracle.cpp build 15-oct-2015 16:53:06

How can I remove everything in a string until a character(s) are seen in Python -

say have string , want remove rest of string before or after characters seen for example, strings have 'egg' in them: "have egg please" "my eggs good" i want get: "egg please" "eggs good" and same question how can delete string in front of characters? you can use str.find method simple indexing : >>> s="have egg please" >>> s[s.find('egg'):] 'egg please' note str.find returns -1 if doesn't find sub string , returns last character of string.so if not sure string contain sub string better check value of str.find before using it. >>> def slicer(my_str,sub): ... index=my_str.find(sub) ... if index !=-1 : ... return my_str[index:] ... else : ... raise exception('sub string not found!') ... >>> >>> slicer(s,'egg') 'egg please' >>> slicer(s,'apple') sub string not found!

meteor - Problems with Iron Router and function computation + template rendering -

i have issue template rendering before subscription received server + computation function calculates necessary data render it. sometimes, works fine , process first subscribes mongodb, renders computevalues() function , loads template. when try same thing again, template renders before actual data calculated , results in below error: exception in template helper: typeerror: cannot read property 'length' of undefined that tells me computevalues() function ran without getting data subscription, went through empty db , couldn't calculation properly. here iron:router code: router.route("/management/bankroll", { subscriptions: function(){ return meteor.subscribe("bank"); }, action: function(){ this.wait(computevalues()); if(this.ready()){ this.layout("bankroll"); } else{ this.layout("loading"); } }, name: "bankroll" }); i tried kinds of hooks onbeforeaction, used .wait()...pretty , behavior still sam

java - Inject SecurityContext info and Request Body into @BeanParam -

currently i'm rendering command object in messagebodyreader i'd able in @beanparam : inject field derived securitycontext (is there somewhere hook in conversion?). have field inject has been materialised messagebodyreader . is possible ? note: go down update. guess is possible use @beanparam . though need inject securitycontext bean , extract name info. there's no way achieve @beanparam corrected . could use messagebodyreader way doing, imo that's more of hack anything. instead, way achieve use framework components way supposed used, involves custom parameter injection. to achieve this, need 2 things, valuefactoryprovider provide parameter values, , injectionresolver own custom annotation. won't explaining example below, can find explanation in jersey 2.x custom injection annotation attributes you can run below example junit test. included 1 class. these dependencies used. <dependency> <groupid>org.glassfish

opengl es - android glsurfaceview stretch to fit -

i using glsurfaceview , it's renderer display gles device full screen. works expected. now want add option "zoom" output size. mean (for example) render gles viewport quarter of screen , stretch full screen when displaying. allow slower shaders rendered faster little blockiness. i can shrink gles size altering glviewport , renders on lower left corner of screen. how can lower quarter stretch fill whole screen? many tips/answers. solution after more trial , error , googling. render quarter sized image full screen. just after glsurfaceview created; glsurfaceview.getholder().setfixedsize(glwidth,glheight); glheight , glwidth internal gles render size. render image 1/4 of screen use glwidth=screenwidth/2 , glheight=screenheight/2 and within onsurfacechanged set glviewport; glviewport(0, 0, screenwidth/2, screenheight/2); bingo. faster rendering (but 2x2 blocky pixels) output. hope helps else issue. you have answer in question, i'l

ios - Forcing a saved image to sync with the iCloud Photo Stream -

i have app takes images periodically, , them uploaded icloud photo stream right after images taken. it appears conditions need met in order work. seems work when running ios 8, device connected wireless, , using uiimagepickercontroller take pictures (rather avcapture) @ least once. seems uiimagepickercontroller when presented alters system settings allows subsequent automatic uploading of images icloud photo stream. if use avcapture take pictures, not work. i've confirmed "upload photo stream" enabled in icloud settings, , there active wireless connection. here method used save image obtained uiimagepickercontroller: - (void)saveimage : (uiimage *)image { // add image photo library [[phphotolibrary sharedphotolibrary] performchanges:^{ phassetchangerequest *assetchangerequest = [phassetchangerequest creationrequestforassetfromimage:image]; } completionhandler:^(bool success, nserror *error) { if (!success) nslog(@&

sql - How to put default values for every column in table? -

this syntax doesn't work: select nvl(student.*,0) student ; how can apply nvl() function every column in student table? we can't that. need type out columns , individual nvl() functions. know seems lot of effort consider happen if of columns date or other "exotic" datatype. if have lot of columns , want save effort generate clauses data dictionary: select 'nvl('|| column_name || ', 0)' user_tab_columns table_name = 'student' order column_id; cut'n'paste result set editor. once start on route it's easy more sophisticated: select case when column_id > 1 ',' end || 'nvl('|| column_name || ',' || case when data_type = 'date' 'sysdate' when data_type = 'varchar2' '''def''' else '0' end || ')' user_tab_columns table_name = 'student' order column_id;

Big .CSV file reading issue in C# -

i try read .csv file using oledb connection , file.readallline("test.csv") give exception "out of memory exception" in both way. my file approx 1,80,00,000 recores in file. file size max 2gb or more. please me....

ios - XCTAssertEqual this or that -

is possible test if result 1 of 2 options? for example: let result = "apple" //could "apple" or "orange" let expected1 = "apple" let expected2 = "orange" xctassertequal(result, expected1 || expected2) xctassert(result.isequal(expected1) || result.isequal(expected2))

numpy - Python .npy file: how to multiply or divide the data? -

i have data file in .npy format. simplicity, let's take following case data={} data["a"]=[1.,2.,3.,4.,5.] data["b"]=[10,20,30,40,50] a=data["a"] b=data["b"] c1=a*b c2=a/b c3=np.sqrt(a/b) this gives following error typeerror: can't multiply sequence non-int of type 'list' typeerror: unsupported operand type(s) /: 'list' , 'list' how above operations these type of arrays? thank you as says, a , b lists. think trying operations on list items have iterate through each item. can list comprehension this: c1 = [x*y x,y in zip(a,b)] c2 = [x/y x,y in zip(a,b)] and etc

linux - delete lines based on number of brackets? -

i trying find best way replace text in file called listener.ora oracle. looking replace "sid_list_listener_orcl" entry else... have couple of things can go wrong here want avoid... first can see entry can either entry#1 or entry#2, first 1 has "sdu=" entry, while second 1 dont...do note file either have entry#1 or entry#2 , not both @ same time(at least not in our environment). second, thinking find of "sid_list_listener_orcl" , delete 6 or 7 lines there, entry varies (sdu= in 1 , not in other) dont think idea... next thing, no matter can come might find environment might have lets 2 more lines in entry script break or cause other error....so nice have work these 2 entry , else might encounter in future...one important thing can think of is, no matter how many lines have 6, 7, 9 or 9 have exact number start , close brackets{ () }... starting "(sid_list =" i know want replace , have part worked out struggling how delete existing line

javascript - Getting the index of ng-repeat after scroll in controller - angular , Ionic -

the below code works fine in browser when same in mobile not working, here codepen link, http://codepen.io/sudan_1993/pen/bowzbn html file <html ng-app="bumblebee"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"> </script> </script> <script src="http://airve.github.io/js/verge/verge.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"> </script> </head> <body> <ion-view> <ion-content overflow-scroll="true"> <div ng-controller="repeatctrl"> <h1 ng-bind="title"></h1> <!--if want search in data use searching.$ --> <input type="text" placeholder="search data" ng-model="searching.$" /> or <!-- searching name --> <in

Folding Haskell code in Emacs -

Image
i following this guide set code folding emacs in haskell. but not seem work: when says in guide , try fold code keybindings not work, nothing happens. if use emacs fold haskell code please share secret how ? haskell folding works quite nicely vim, :set foldmethod=indent , can zc zo , haskell code folds in , out, now, how can in emacs ? i have spent few hours trying figure out failed, please enlighten me. i'm not sure how date haskell wiki. prefer vimish-fold folding haskell code in emacs. folding have is, select code , apply function vimish-fold . unfolding, go beginning of folded code , run command vimish-fold-unfold .

python - Django UUIDField issue -

i trying uuidfield work in python django using following model: class ticket(models.model): id = models.uuidfield(primary_key=true, default=uuid.uuid4, editable=false) name = models.charfield(max_length=50) however when try adding instance of model database returns following error: typeerror @ /tickets/ coercing unicode: need string or buffer, uuid found the documentation of uuidfield short , doesn't me. edit: did import uuid , here full traceback: environment: request method: request url: http://127.0.0.1:8000/tickets/ django version: 1.8.5 python version: 2.7.9 installed applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'events', 'rest_framework') installed middleware: ('django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.commo

php - AJAX: how to post empty arrays? -

i have associative array lists. take @ following json: console.log(json.stringify(fields); output { "sb1":[], "sb2":["val1","val2","val3"], "sb3":["val1","val2","val3"] } as can see, array-entry "sb1" empty. array "sb1" disappear while posting var "fields" php. here code-snippet: $(document).ready(function() { $("#button").click(function(e) { e.preventdefault(); var fields = {}; //the following saves selectboxes , options in var fields// $("select").each(function() { var $select = $(this); fields[$select.attr('name')] = $select.find('option').map(function() { return $(this).val(); }).get(); }); var jsonobj = fields; var jsonstringify = json.stringify(fields); console.log("json.stringify(fields): " + jsonstringify); //result ok $.ajax({