Posts

Showing posts from May, 2013

regex - htaccess - how to not redirect based on url pattern -

regex - htaccess - how to not redirect based on url pattern - rewriteengine on rewritecond %{http_host} !^www\.example\.com rewriterule (.*) http://www.example.com/$1 [r=301,l] # load index.php default directoryindex index.php rewritebase / # other requests load room.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^((?!(index|room)\.php).+)$ room.php?u=$1 [l,nc] my htaccess redirect room.php if url contains else root directory such http://www.example.com/anythingelse if not simple direct index.php but need able not include redirect particular patters can create content in particular folders. instance http://www.example.com/1 http://www.example.com/2 http://www.example.com/3 http://www.example.com/4 is possible? you can add together these exclusions in regex pattern: rewriteengine on rewritecond %{http_host} !^www\.example\.com rewriterule (.*) http://www.example.com/$1 [r=301,l] # load index.php default directory

Printf Assembly Language Stack pointer nasm intel -

Printf Assembly Language Stack pointer nasm intel - setup: nasm intel 64bit ubuntu getting segmentation error when include printf line. without including compiles , runs fine. trying print 1 in code. does calling printf print whatever @ stack pointer? dd2 @ stack pointer when printf called here? i popped lastly 2 items have stack homecoming initial position. all help appreciated, have great evening! section .data dd: db 1 dd2: db "%d" extern printf section .text global main main: force dd force dd2 phone call printf pop rax ; pop rbx ; ret the calling conventions 64 bit different used 32bit. http://en.wikipedia.org/wiki/x86_calling_conventions scroll downwards x86-64 tell first 6 parameters passed in registers: 1st param in rdi, 2nd param in rsi, 3rd param in rdx, 4th rcx, 5th r8, 6th r9, more , passed on stack; floating point params passed in xmm0–7 so, printf phone call should be: mov rsi, dd mov

python - Writing to a uWSGI unix socket -

python - Writing to a uWSGI unix socket - i have python wsgi app served uwsgi behind nginx. nginx listens on network , forwards requests uwsgi unix socket located in /tmp/uwsgi.socket . now, i'm trying emulate i'm speculating nginx when talking socket. i've tried next using python: import socket uwsgi_socket_address = "/tmp/uwsgi.sock" socket_client = socket.socket(socket.af_unix, socket.sock_stream) socket_client.connect(uwsgi_socket_address) msg = "get /index http/1.1\r\n" socket_client.sendall(msg) i error in return /usr/lib/python2.7/socket.pyc in meth(name, self, *args) 222 223 def meth(name,self,*args): --> 224 homecoming getattr(self._sock,name)(*args) 225 226 _m in _socketmethods: error: [errno 32] broken pipe 1) i'm trying possible socket , uwsgi? if missing work? 2) there python utility can help me in crafting text http requests, rather querying server on behalf? : >>> import some

javascript - How to properly stop Meteor Tracker.autorun? -

javascript - How to properly stop Meteor Tracker.autorun? - i have following: meteor.startup(function() { var computation = tracker.autorun(function() { var currentchapter; currentchapter = chapters.findone({ _id: currentchapterid }); if (currentchapter) { if (currentchapter.title) { $("#input-title").val(currentchapter.title); } else { $("#input-title").val(""); } if (currentchapter.content) { $("#input-content").html(currentchapter.content); } else { $("#input-content").html(""); } } homecoming computation.stop(); }); }); right get: exception tracker afterflush function: cannot phone call method 'stop' of undefined typeerror: cannot phone call method 'stop' of undefined what want stop computation 1 time currentchapter true. doing wrong? two things: 1 - autorun function gets

java - Sort array by length of sub arrays -

java - Sort array by length of sub arrays - so have 2d array graph represents adjacency list: 0:2 1 0 1:0 2: in array format thats: [[2,1,0],[0],[]] what want sort specific row (say graph[0] ) length of sub array (the border list). in illustration above sorted graph like: 0:0 1 2 1:0 2: [[0,1,2],[0],[]] since graph[0].length = 3 , graph[1].length = 1 , graph[2].length = 0 . i've tried using: arrays.sort(graph[v], new degreecomparator(graph)); class degreecomparator implements comparator<integer> { int[][] graph; public degreecomparator(int[][] g) { graph = g; } public int compare(integer c1, integer c2) { homecoming integer.compare(graph[c1].length, graph[c2].length); } } but sort method won't take format. can explain i'm doing wrong? edit clarity: because above illustration uses numbers it's bit confusing i'll add together sec case: 0: 4 1 2 1: 1 2 3 2: 3: 4 1 4: 0 [[4,1,2],[1,2,3],[

c++ - SSE / Optimisation - duplicating array into larger array -

c++ - SSE / Optimisation - duplicating array into larger array - i'm trying optimize next function: (basically takes line of 32bit ints, , duplicates each int larger destination arrray, , duplicates each line for(int = 0; < numlines; i++) { pstartofline = pdest; for(int j = 0; j < intsperlinesrc; j++) { *pdest = *psrc; // re-create pixel fullsizebuffer pdest++; // move dest ptr next pixel *pdest = *psrc; // re-create pixel fullsizebuffer 1 time again pdest++; // move src , dst pointrs next pixels psrc++; } memcpy(pdest, pstartofline, (8*intsperlinesrc) ); // duplicate line written pdest, next line of pdest. pdest = pdest + (2*intsperlinesrc); // move pdest start of next line } effectively scaling image 2 * it's original size in both dimensions. strikes me should

tsql - SQL - insert into QUOTENAME(@DatabaseName) -

tsql - SQL - insert into QUOTENAME(@DatabaseName) - declare @databasename varchar(30), @article varchar(16), @partnerid int set @databasename = 'demo' set @article = 'article1' set @partnerid = 1 insert quotename(@databasename) + '.dbo.move(article, partner, note)' select @article, @partnerid, 'note' i have , error is: msg 102, level 15, state 1, line 7 wrong syntax near '+'. i try: declare @sql nvarchar(max) declare @databasename varchar(30), @article varchar(16), @partnerid int set @databasename = 'demo' set @article = 'article1' set @partnerid = 1 set @sql = n'insert '+ quotename(@databasename) + n'.dbo.move(article, partner, note)' + n'select ' + @article + n', ' + @partnerid + n', '''note''' ' exec @sql but error: msg 102, level 15, state 1, line 9 wrong syntax near 'note'. if going utilize dynamic sql (which sho

Alert User when someone replies to their post - SharePoint 2013 Community -

Alert User when someone replies to their post - SharePoint 2013 Community - i looking solution standard concept. in social communities, there way user alerted if responds posted. however, not seeing way accomplish in sharepoint 2013 community site. need assistance. there way accomplish this? -nick you can alert on item if changes. there no oob way alert on response item. you can set alerts on list new items not specific items (other changes item). sharepoint sharepoint-2013 sharepoint-online sharepoint-alerts

sql - Mysql RANK is not giving RANK for each category -

sql - Mysql RANK is not giving RANK for each category - i tried next thing not ranking each category wise. instead giving rank records without considering category. want rank re-occur each category select rs.section,rs.field1,rs.field2 , @currank := @currank + 1 rank ( select rs.field1,rs2.field2 table rs inner bring together table2 rs2 on rs.field1=rs2.field1 grouping rs.section,rs.field1 )rs, (select @currank := 0) r actual output: (from mysql output ) category field1 field2 rank male 10 10 1 male 11 10 2 male 12 10 3 .... female 10 10 11 female 11 10 12 female 12 10 13 .... expected output category field1 field2 rank male 10 10 1 male 11 10 2 male 12 10 3 .... female 10 10 1 female 11 10 2 female 12 10 3 .... i assume query working is: select rs.category, rs.field1, rs.field2, @currank := @currank + 1 rank (sele

replacewith - jquery add tag after another tag -

replacewith - jquery add tag after another tag - i have following: <h3>my title</h3> and add together following: <h3><span>my title</span></h3> i have tried accomplish following: $( "<h3>" ).replacewith( "<h3><span>" ); $( "</h3>" ).replacewith( "</span></h3>" ); but above doesn't seem working. approaching in right way? you can't replace element string. in case can utilize .wrapinner() class="snippet-code-js lang-js prettyprint-override"> $('button').click(function() { $('h3').wrapinner('<span />'); }) class="snippet-code-css lang-css prettyprint-override"> h3 span { color: red; } class="snippet-code-html lang-html prettyprint-override"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></sc

scala - Spark NullPointerException inside foreach loop -

scala - Spark NullPointerException inside foreach loop - i have rdd , want loop on it. this: pointsmap.foreach({ p => val pointswithcoordinateswithdistance = pointsmap.leftouterjoin(xcoordinateswithdistance) pointswithcoordinateswithdistance.foreach(println) println("---") }) however, nullpointerexception occuring: java.lang.nullpointerexception @ org.apache.spark.rdd.rdd.<init>(rdd.scala:125) @ org.apache.spark.rdd.cogroupedrdd.<init>(cogroupedrdd.scala:69) @ org.apache.spark.rdd.pairrddfunctions.cogroup(pairrddfunctions.scala:651) @ org.apache.spark.rdd.pairrddfunctions.leftouterjoin(pairrddfunctions.scala:483) @ org.apache.spark.rdd.pairrddfunctions.leftouterjoin(pairrddfunctions.scala:555) ... both pointsmap , xcoordinateswithdistance initialized before foreach , contain elements. not within foreach loop leftouterjoin works. total version of code please see https://github.com/timasjov/spark-learning/blob/maste

video - FFmpeg audio channel rematrix (5.1 to stereo) -

video - FFmpeg audio channel rematrix (5.1 to stereo) - i've got (very large!) apple prores 422 file 16ch audio. able utilize on less powerful computer, i'd convert standard mp4 file (h264 video codec, stereo audio). original file has 16 channels of audio, however, , ffmpeg gives error when seek convert ('rematrix needed'). how do rematrixing of sound channels? there additional steps needed? this ffmpeg command used: ffmpeg -y -i capture0000.mov -vcodec libx264 -vb 2000k -pix_fmt yuv420p -coder 0 -profile:v baseline -acodec libfaac -ab 128k /tmp/out.mp4 this ffmpeg output: ffmpeg version 2.2.git copyright (c) 2000-2014 ffmpeg developers built on may 8 2014 14:17:45 gcc 4.6 (ubuntu/linaro 4.6.3-1ubuntu5) configuration: --prefix=/usr/local/ffmpeg_build --extra-cflags=-i/usr/local/ffmpeg_build/include --extra-ldflags=-l/usr/local/ffmpeg_build/lib --bindir=/usr/local/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --ena

sql server - java.sql.SQLException: An attempt by a client to checkout a Connection has timed out -

sql server - java.sql.SQLException: An attempt by a client to checkout a Connection has timed out - i have java client server supposed found connection pool on startup failing on timeout error. there many threads on same issue none of solutions worked me am using jdk 7 , below mchange maven dependency <dependency> <groupid>com.mchange</groupid> <artifactid>c3p0</artifactid> <version>0.9.2.1</version> </dependency> jdbc.properties url=jdbc\:sqlserver\://server\\instance;databasename\=db driver=com.microsoft.sqlserver.jdbc.sqlserverdriver user=admin password=admin maxpoolsize=20 minpoolsize=5 acquireincrement=5 here dao class establishes connection-pool on server startup public class sharedocdao { //.......... private static connection getconnection() throws sqlexception { log.info("getting db connection"); combopooleddatasource cpds = getpool(); homecoming cpds.getconn

android - adb cannot start daemon, CreateProcess failure, error 2 -

android - adb cannot start daemon, CreateProcess failure, error 2 - i unable run adb root or adb command. next error. set adb_trace=1 : c:\windows\system32>adb root system/core/adb/adb.c::main():handling commandline() system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version system/core/adb/sysdeps_win32.c::socket_loopback_client():socket_loopback_client: not connect tcp:5037 system/core/adb/adb_client.c::adb_connect():adb_connect: service root: * daemon not running. starting on port 5037 * createprocess failure, error 2 * failed start daemon * error: cannot connect daemon i using windows 7. from netstat -a don't see else using port 5037. when run adb, observe adb momentarily displayed on task manager, goes away. windows firewall turned off. same results if run cmd administrator. first remove duplicate copies of adb binaries open 2 command prompt windows - 1 administrator , regular user run next command few times until responds 3

sql server - VBScript, SQL Integrated security, DB Connection Timeout -

sql server - VBScript, SQL Integrated security, DB Connection Timeout - i have vbscript connects sql server. using integrated security in connection string: provider=sqloledb;data source=servename;initial catalog=databasename; integrated security='sspi'; everything works when execute script double clicking .vbs file, when schedule .vbs file run through task scheduler, connection database times out. i have task scheduler set run using credentials work when executing manually. i hope plenty info , can help me problem is. please kind virgin has gotten lots of answers here before, has never asked question before. try this: setting connection timeout in connection string provider=sqloledb;data source=servename;initial catalog=databasename; integrated security='sspi';connection timeout=300; msdn sql-server vbscript scheduled-tasks

java - Building a Trie Tree to hold words as added -

java - Building a Trie Tree to hold words as added - hello building trie tree , code right me not add together words after first word added. @ , tell me think. this trie class not working: public class trie { private static class trienode { public char letter; public boolean terminal; public trienode[] children; } private trienode root; public trie() { root = new trienode(); root.letter = ' '; root.terminal = false; root.children = null; } public boolean find( string word ) { homecoming find( root, word, 0 ); } public void add( string word ) { add( root, word, 0 ); } public string tostring() { homecoming traverse( root, "" ); } private static boolean find( trienode node, string word, int index ) { if(index == word.length()) homecoming node.terminal; if(node.children != null) for(

java - Translator, only accepts one word, why not the rest -

java - Translator, only accepts one word, why not the rest - i trying create programme translates english language piglatin. have of components, if come in in more 1 word, translates first word. issue , how prepare it. public class piglatin{ public static string translate(string phrase){ string [] returnarray=phrase.split(" "); string [] translatearray=new string [returnarray.length]; for(int i=0;i<returnarray.length;i++){ translatearray[i]=translateword(returnarray[i]); } homecoming stringlib.join(translatearray, " ");//translated array } public static string translateword(string word) { string tword=word; int indexvowel=indexoffirstvowel(tword); if(indexoffirstvowel(tword)==0){ tword=tword+"yay"; } else { tword=tword.substring(indexoffirstvowel(tword),tword.length())+tword.substring(0,indexoffirstvowel(tword))+"ay"; } homecoming tword; } public static int indexoffirstvowel(string word) {//check first vowel string vowe

normalization - Effect of feature scaling on accuracy -

normalization - Effect of feature scaling on accuracy - i working on image classification using gaussian mixture models. have around 34,000 features, belonging 3 classes, lying in 23 dimensional space. performed feature scaling on both training , testing info using different methods, , observed accuracy reduces after performing scaling. performed feature scaling because there difference of many orders between many features. curious know why happening, thought feature scaling increment accuracy, given big differences in features. i thought feature scaling increment accuracy, given big differences in features. welcome real world buddy. in general, quite true want features in same "scale" don't have features "dominating" other features. if machine learning algorithm inherently "geometrical" in nature. "geometrical", mean treats samples points in space, , relies on distances (usually euclidean/l2 case) between points in

c# - Search multiple Mongo columns for multiple entries -

c# - Search multiple Mongo columns for multiple entries - i have made nice pageing scheme ajax dynamic .net, mongodb, , twitter bootstrap. works great have text box user can search , ajax/mongo driver search fields of collection , homecoming results, perfect illustration of goal can seen here @ datatables plugin. have tried few things such combing of columns or: query.or( query.matches("name", new bsonregularexpression(query, "i")), query..matches("facility.name", new bsonregularexpression(query, "i")), etc... ) which suppose in theory way it, hopeing solution little more universal. when utilize info tables plugin linked search info no matter , organize (i realize html not db) there systematic way mongodb? 1 have pointers? mongodb text indexes allow create text index on specific fields within document or on fields within each document. after you've created index can utilize $text operator performa search

unique keyword in php which replace with defined variable -

unique keyword in php which replace with defined variable - i want function in php replace unique word defined value. i.e define("url","http://example.com"); define("website","stackoverflow"); $string = "this dummy text {url} & name of website {website}"; now want output as: dummy text http://example.com & name of website stackoverflow. i have function work fine php 5.4 define("url","http://example.com"); define("website","stackoverflow"); function magickeyword($data) { $url = url; $sitename = website; homecoming preg_replace('/\{([a-z]+)\}/e', "$$1", $data); } but in php 5.5 deprecated /e modifier. deprecated: preg_replace(): /e modifier deprecated, utilize preg_replace_callback instead now please help me. the callback function used this: define("url","http://example.com"); define("website","stackoverf

perl - How to avoid empty elsif? -

perl - How to avoid empty elsif? - the below code want, tells me, empty elsif not practice. purpose create sure $type either snap or fs , alter $t if snap . my $t = ""; if ($type eq "snap") { $t = "-t snapshot"; } elsif ($type eq "fs") { } else { fatalerror("must either snap or fs") } question how do same, without empty elsif ? how about: my $t = ""; if ($type eq "snap") { $t = "-t snapshot"; } elsif ($type ne "fs") { fatalerror("must either snap or fs") } perl

c# - How to return a object properties through a Result -

c# - How to return a object properties through a Result - i trying properties of object. not sure how type of relationship using. returning of jobs in db. jobs has one-to-many relationship customeremployee class. need of properties in customeremployee class accessible through job list. have managed first & lastly name of customeremployee don't see how can access other properties using way. don't know if need alter way have relationship setup? leads me next question, when create new job post, foreign key not beingness inserted in right column. db has 2 different columns.example, "jobtespmid" & "jobtespmid_employeeid". need id inserted in "jobtespmid_employeeid" beingness inserted in other one. got kind of lost when setting understand why happening. public class job { public int64? jobid { get; set; } public int? jobnumber { get; set; } public string jobname { get; set; } public string jobdescription { get; set; }

php - Symfony2 doctrine join OneToMany don't work -

php - Symfony2 doctrine join OneToMany don't work - i have 2 connected entities in onetomany connection, when seek query them out next error notice: undefined index: mybox in /var/www/pp/vendor/doctrine/orm/lib/doctrine/orm/query/sqlwalker.php line 887 my entities next : mybox (one) <?php namespace pp\corebundle\entity; utilize doctrine\orm\mapping orm; utilize doctrine\common\collections\arraycollection; utilize gedmo\mapping\annotation gedmo; /** * @orm\entity(repositoryclass="pp\corebundle\repository\myboxrepository") * @orm\table(name="mybox") */ class mybox { public static $collectingtypeany = 0; public static $collectingtypefixed = 1; public static $collectingtypeminimum = 2; /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\manytoone(targetentity="pp\userbundle\entity\user") * @o

python - How should method names be named in a send/receive environment? -

python - How should method names be named in a send/receive environment? - this question posed in python context extends other languages. doing creating simulation distributes systems in network , want have ability of sending messages nodes other adjacent nodes in network. have written node class. i understand how finish problem of simulating network, problem this: if want node send message node, how should name methods best readability? have this: class node: def send_message( self, othernode, message ): othernode.receive_message( self, message ) def receive_message( self, othernode, message ): # do message but term "receive_message" feels wrong. there standard situation? python oop

objective c - MKPolylines-routeLines not showing in my MKMapView, but everything is correct? -

objective c - MKPolylines-routeLines not showing in my MKMapView, but everything is correct? - i new may i'm missing simple or whatever else. basically want draw straight line point point, in case have of points in each line should drawn in array of coordinates. , utilize overlay method draw line. , of in mkmapview defined , configured (correctly). so here code utilize fill array of coordinates , create overlay/polyline: cllocationcoordinate2d coordinatearray[arrayoflatitudes.count]; (int = 0; < arrayoflatitudes.count; i++) { double templatitude = [[arrayoflatitudes objectatindex:(i)] doublevalue]; double templongitude = [[arrayoflongitudes objectatindex:(i)] doublevalue]; coordinatearray[i] = cllocationcoordinate2dmake(templatitude, templongitude); } self.routeline = [mkpolyline polylinewithcoordinates:coordinatearray count:arrayoflatitudes.count]; [self.mapview setvisiblemaprect:[self.routeline boundingmaprect]]; //if want route visible [self

A PHP script to let users download a file from my website without revealing the actual file link in my website? -

A PHP script to let users download a file from my website without revealing the actual file link in my website? - the question says all.. how allow users download file website , not allow them see link file comes from? understand there might need download.php serve gateway past phase, dunno script next... if bothers write whole code, few function names should need utilize handy! find way identify file download (for instance, variable matches id of row in database, or along these lines). create damn sure it's valid one, because don't want users able download off site. then, utilize header content-disposition tell browser file should downloaded, , readfile output it. for instance: <?php $id = intval($_get['id']); $query = mysql_query('select file_path files id = ' . $id); if (($row = mysql_fetch_row($query)) !== false) { header('content-disposition: attachment; filename=' . basename($row[0])); readfile($row[0]); } exit;

c++ - sorting table in place using stl sort -

c++ - sorting table in place using stl sort - i have huge table (about 50gb) in (i,j,k) format (from sparse matrix) stored uint32_t * idx1, * idx2; float * vals; uint32_t tablesize; and i'd sort in place given comparing function that's function of idx1 , idx2. can done using std::sort? specifically, each nonzero entry (i,j) value v in sparse matrix stored placing in idx1, j in idx2, , v in corresponding entry in vals. i'd sort these entries according (i1, j1, v1) <= (i2, j2, v2) if (i1 < i2) || (i1==i2 && j1 <= j2) the examples i've been able scrounge of using std::sort on nonstandard datatypes assume each item beingness compared single instance of class; here each item represented 3 values in different arrays. if have maintain using existing info structure, std::tuple of 3 std::vector s, using boost::zip_iterator seem way go. zip_iterator treats 3 iterators (two indices , 1 value) single tuple, , can utilize custom c

Making concurrent canvas animations in JavaScript? -

Making concurrent canvas animations in JavaScript? - i'm learning javascript canvas recently, , came 2 ways of making animations. searched google while cannot determine way correct. say have want render different objects doing different things on canvas 30 fps. there're 2 ways accomplish this. for both 2 ways, there should main setinterval function draw objects in 30fps. every object has nextframe(user_response) method, changes 'status' of object according user response, , called main setinterval 30 times ps. main setinterval need pass user responses each nextframe(...) in way, , calls draw each object. --the problem approach nextframe objects called per frame, taking scheme resources. objects implement own animation methods with setinterval . these methos called according user response, changing object 'status' 30 times per second. , main setinterval function calls draw each object in 30fps, behaving 'taking pictures' of each ob

automation - scheduling automated file name change -

automation - scheduling automated file name change - i'm trying schedule task edit names of images. images 123-1234.jpg 123_1234.jpg example. this have now. powershell.exe -noexit -command "cd'c:\path\i\want" get-childitem -filter "*.jpg" -recurse | rename-item -newname {$_.name -replace "-", "_" } appreciate help. my reasons needing code have 1 software produces images in various extensions way names files 12345-123456.jpg the other software have imports names 12345_123456.jpg. this solve me needing 3rd party software if can create automated task alter .jpg in directory needed name format automated import. powershell.exe -noexit -command get-childitem 'c:\my\file\path\' -filter "*.jpg" -recurse | rename-item -newname {$_.name -replace '-','_' } im proud of myself first time using powershell. worked fine. automation scheduled-tasks batch-rename

jquery - Why does the Chosen Select DropDown goes under the footer DIV -

jquery - Why does the Chosen Select DropDown goes under the footer DIV - i have next html: <!-- header content --> <div class="bodymaincontentholder" style="min-height: 750px;"> <div class="sectionfp grouping visoverflow"> <div class="col span_1_of_3_cust span_pad_right"> <div class="smallpadtop brclear setleft"> <div class="setbold brclear">select language:</div> <div class="chosenddlholder"> <asp:dropdownlist clientidmode="static" id="ddllanguage" cssclass="chosen-select setprovddstyle" runat="server" appenddatabounditems="true"></asp:dropdownlist> </div> </div> </div> </div> </div> </div> <!-- footer cont

sharepoint - Retrieve content type columns values in C# -

sharepoint - Retrieve content type columns values in C# - i have document library content type multiple columns in sharepoint2010. retrieve values in column using next code fails. objcurrentweb = spcontext.current.web; objlist = objcurrentweb.lists["mynewlists"]; foreach (splistitem objlistitem in objlist.items) { id = (objlistitem["applicationid"]).tostring(); } how retrieve values in content type columns correctly? thank you! it can fail in 2 cases: 1) there no such field "applicationid". ensure utilize field internal name 2) (objlistitem["applicationid"]) null, fails nullreferenceexception on casting string. c# sharepoint sharepoint-2010 content-type document-library

ruby - Separate an array of arrays to be passed into a method as multiple objects -

ruby - Separate an array of arrays to be passed into a method as multiple objects - i have method accepts multiple arrays splat operator taken thread. def interleave(a,*args) max_length = args.map(&:size).max padding = [nil]*[max_length-a.size, 0].max (a+padding).zip(*args).flatten.compact end i have array of arrays: my_array = [[1,2],[3,4],[5,6]] how pass interleave(my_array) so passes subarrays in separately? can't seem separate my_array (of there can hundreds) separate objects. what think you're attempting can accomplished using splat operator @ time of method invocation, such: hello(*my_array) here's finish example: def foo(a, *b) puts a.inspect puts b.inspect end foo(*[[1, 2], [3, 4], [5, 6]]) prints following: [1, 2] [[3, 4], [5, 6]] edit: other solution now you've pasted source sentiment method should re-written take single parameter instead of using splat operator in parameters pull out f

windows - Register a thumbnail handler for a folder, rather than a specific file type -

windows - Register a thumbnail handler for a folder, rather than a specific file type - i need write thumbnail handler files under given folder. folder mounting point virtual file scheme (using callback file system), , files not nowadays physically on local machine (they're stored in cloud), if allow default thumbnail handler work, seek download whole files server... not want. but realized thumbnail handler must registered per file type: registration of thumbnail handler based on standard file associations. (from documentation) i don't want register per file type, because don't want alter behavior files not in virtual folder. there way handler called files in virtual folder, , them? i see 2 ways go. the simple way: register own thumbnail handler , allow work on files. when don't back upwards iinitializewithstream iinitializewithitem or iinitializewithfile can check if item/file in virtual file system. if can homecoming thumbnail , o

iterm - Scandinavian characters in tmux -

iterm - Scandinavian characters in tmux - # .tmux.conf set -g status-utf8 on setw -g utf8 on yet, still when come in scandinavian charaters æ , ø , å in terminal window, next output: <00c3><00a6><00c3><00b8><00c3><00a5> i'm using iterm2 terminal, , characters printed correctly outside of tmux. are using zsh? able produce result (inside , outside tmux) setting lc_ctype en_us.us-ascii while sending utf-8 (i.e. lying zsh (and other locale-sensitive programs) character set expect). check lc_all, lc_ctype, and/or lang have appropriate values within tmux session; want utilize consistent value ends .utf-8 . can utilize locale view active values , locale -a list available values. you may need reset errant variable(s) in tmux global and/or sessions environments (so new sessions/windows/panes not maintain getting bad values). can inspect tmux global environment with tmux show-environment -g | grep -e 'lc|lang

map with list as value in SOQL -

map with list as value in SOQL - i'm working on little project in salesforce client can master in master-detail relationship more single project object. projects have currency 'max_budget__c' , want calculate max budget per client adding max_budget__c per project. means need collect list per client need client stored can update max_budget__c object of it. thinking storing in map customer__c key , set value, i'm not sure how in single soql query or if i'm looking in right direction. ideas? in advance let suppose have multiple projects project1, project2 etc . each has many 1 relationship customer. i.e many project1 records single client record. many project2 records single client record , on. so each client have many project1 records,project2 records etc.. to calculate max budget per client need calculate max budget project1 records,max budget project2 records etc..from each client , add. so requirement simple write roll summary on

ios - Running pod update changes Pods build settings -

ios - Running pod update changes Pods build settings - when run pod upate against podfile build settings architectures section pods project changed: supported platforms changes os x (from ios) build active architectures changes yes (from no) base sdk changes no sdk (latest os x) latest ios i don't know why it's changing that. i'm having (or not having) in podspec file dependencies? here illustration of 1 of podspec files: pod::spec.new |spec| spec.name = 'pi-ios-sdk' spec.version = '1.2.0' spec.license = { :type => 'copyright', :text => 'copyright 2014 <...>. rights reserved.' } spec.homepage = 'http://<...>.com/' spec.authors = '<...> grid mobile frameworks team' spec.summary = '<...> identity authentication grid projects.' spec.description = 'the <...&

ios - dataWithContentsOfURL crash when running on iOS8 -

ios - dataWithContentsOfURL crash when running on iOS8 - datawithcontentsofurl crashes on ios8 when host not reachable , there net connection. nsurl *url = [nsurl urlwithstring:myurl]; @try { info = [nsdata datawithcontentsofurl:url]; } @catch (nsexception *exception) { info = nil; } if(data!=nil){ [data writetofile:filepath atomically:yes]; }else{ info = [nsdata datawithcontentsoffile:filepath]; if (data==nil) { homecoming nil; } } from documentation: important: not utilize synchronous method request network-based urls. network-based urls, method can block current thread tens of seconds on slow network, resulting in poor user experience, , in ios, may cause app terminated. if need know reason failure, utilize datawithcontentsofurl:options:error: or instead, non-file urls, consider using datataskwithurl:completionhandler: method of nssession class. ios i

java - Service code stops when application is stopped -

java - Service code stops when application is stopped - i have app gets users messages database , if there new message pushes notification utilize service that.. service works fine when app opened or in foreground.. when close it doesn't work.. not destroyed or stopped it's doesn't work :s don't know why.. service code : public class bgservice extends service { arraylist<message> messages = new arraylist<message>(); arraylist<string> requests = new arraylist<string>(); timer timer = new timer(); timer timer2 = new timer(); @override public ibinder onbind(intent intent) { // todo auto-generated method stub homecoming null; } @override public void ondestroy() { log.d("chat", "bgservice destroyed"); timer.cancel(); timer.purge(); timer2.cancel(); timer2.purge(); } @suppresswarnings("unchecked") @override public void onstart(intent intent, int startid) { log.d("chat"

C socket - consecutive read/write, what happens? -

C socket - consecutive read/write, what happens? - in server/client in c, tcp, happens if consecutive read/write in program? possibile, or i've follow construction "client write->server read->server write->client read"? is possible this? or possible info 3rd write in server received 2nd read in client, , other bad things this? client.c write (1) read (2) read (3) read (4) server.c read (1) write (2) write (3) write (4) yes, possible. reads block (by default) until info available read on socket. there's no need seek arrange reads , writes in particular order, programme wait until there read before read() phone call returns. your code result in this: server blocks in read() client write()s client blocks in read() server receives data, read() returns server write()s 3 times client receives data, read(1) returns client's read(2) called , returns info arrive client's read(3) called , returns info arrive on fas

mysql - Cannot add or update a child row: a foreign key constraint fails -

mysql - Cannot add or update a child row: a foreign key constraint fails - i need help...while creating database kept running error: error 1452 (23000): cannot add together or update kid row: foreign key constraint fails (`accident_db`.`participated`, constraint `participated_ibfk_2` foreign key (`license`) references `car` (`license`)) the problem come in hand when seek insert participated. tried making whole database over, coding diff way, checking spelling, , other grammar errors. create table person ( driver_id varchar(9) primary key, name varchar(25), address varchar(40) ) engine=innodb; create table auto ( license varchar(8), model varchar(15), year date, primary key(license) ) engine=innodb; create table accident ( report_id varchar(6), date date, location varchar(25), primary key(report_id) ) engine=innodb; create table owns ( driver_id varchar(9), license varchar(8), foreign key(driver_id) references person(driver_id), foreig

url - angularjs routes parameters issue -

url - angularjs routes parameters issue - how can parameter such url in angularjs controller: http://localhost:53315/employee/{parameter}#/info here's angularjs code: $routeprovider .when('/info', { controller: 'userctrl', templateurl: basetemplateurl + 'info.html' }); .controller('userctrl', ['$rootscope', '$scope', '$location', '$routeparams', 'user', function ($rootscope, $scope, $location, $routeparams, user) { $rootscope.user = user.get({ id: $routeparams.id }); thank in advance help! i think you'll have parse $location.absurl() it. angularjs url parameters

JPA and Spring data: why did I get delete error -

JPA and Spring data: why did I get delete error - i have 3 classes (a has many b, has many c) : class { @onetomany (mappedby="a", fetch = fetchtype.lazy, cascade=cascadetype.all) public list<b> bs; public list<b> getbs() { homecoming bs; } public void setbs(list<b> bs) { this.bs = bs; } } class b { @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "a") private a; public geta() { homecoming a; } public void seta(a a) { this.a = a; } @onetomany (mappedby="b", fetch = fetchtype.lazy, cascade=cascadetype.all) public list<c> cs; public list<c> getcs() { homecoming cs; } public void setcs(list<c> cs) { this.cs = cs; } } class c { @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "b") private b b; public b getb() { homecoming b; }

Indirect reference (alias) to custom xml attribute in android -

Indirect reference (alias) to custom xml attribute in android - si have custom android view. has custom attribute: <com.my.customview custom:attribute="value_1" android:layout_height="wrap_content" android:layout_width="wrap_content" /> custom:attribute flag, defined by: <resources> <attr name="attribute"> <flag name="value_1" value="8"/> <flag name="value_2" value="9"/> </attr> <declare-styleable name="customview"> <attr name="lobby_orientation"/> </declare-styleable> </resources> what i'd modify value per config. illustration should value_1 in portrait, , value_2 in landscape. i'd create file in values-port , and other file in values-land: <resources> <what_to_write name=&