Posts

Showing posts from January, 2014

c++ - Linux server, upload a file to windows client (Socket) -

when send file client gets corrupted, , size in bytes higher. i have version of server running on windows , works perfectly,but i'm not having same result on linux. the file size on disk may error in time send size in bytes client runs on platform? fread function being used correctly? an expert can analyze , find error? linux server side // function upload file client windows int socket_setup::file_upload(int id, std::string dir_upload) { char block[1024]; long filesize; int bytesread; fp = fopen(dir_upload.c_str(), "rb"); if (!fp) { errno_message.append((char*)strerror(errno)); function_log(errno_message); return 1; } fseek(fp, 0, seek_end); filesize = ftell(fp); rewind(fp); long size_send = htonl(filesize); total = filesize; // sending file size windows client iresult = send(client[id].socket, (const char*)&size_send, sizeof(long), 0); if (i...

How to track deployment to Azure webapp in NewRelic? -

background info: have set azure automatically deploy code develop branch (on github) dev-webapp when code pushed develop branch. when code pushed master branch, azure deploys code master branch test-webapp , pre prod-deployment slot. in azure i'm using new relic appservice monitor these apps. works. want notify new relic when code deployed webapp. quote new relic: to notify new relic of deployment, can post https://api.newrelic.com/deployments.xml , add api key header to notify new relic when code deployed dev , test, set webhook in github run when code pushed develop-branch , master-branch. have tested this, , works. feel not optimal since notification comes github, , not azure deployment takes place. i want notify new relic when pre-prod deploymentslot swapped prod. is possible? , best way this? maybe webjobs soulution? should webjob runs once after webapp deployed , deployment-slot swapped (for prod). cannot find information setting such job. use ...

javascript - Accessing function on scope in directive link function -

i have directive setup follows: angular.module("app", []).directive("mydirective", function(){ return { scope: {}, link: function($scope){ $scope.myfunction = function(){ //do dom manipulation } } } }); and in html have <div my-directive> <a href="" ng-click="myfunction()">click me</a> </div> when click "click me" nothing prints console, however, if remove scope property or change scope:true works expected. know has isolate scope don't understand what's going on. want have isolate scope going modular directive use in many different project. note: i'm using angular 1.4.6 update: function needs dom manipulation. why it's in link function. the reason isn't working because how link being used. since elements exist within directive before exists, elements aren't compiled information insid...

Laravel API Authentication -

i building api using laravel used both mobile , web applications. confused regarding authentication. basically web application used users both in logged in state , visitor state. how authentication work in case? if api uses username/password authenticate user visitors? also, how make sure webapp , mobile app thats making request api? how ensure doesn't programatically doesn't access api , apps can request access data? you have routes file, , able apply filter (laravel 4) / middleware (laravel 5) routes protect them. assuming using l5 - route::group('api/v1', function() { route::group(['middleware' => 'api.auth'], function() { route::get('protected', function() { return response()->json(['authenticated response'], 200); }); }); route::get('guest', function() { return response()->json(['guest response'], 200); }); }); then need create middleware api.auth - ...

sql - Displaying data with JSON encapsulated data -

hello have series of rows in sql one: id labels 979392 [2065027,236757,1831024,2398859,2497110] now convert multiple rows this: id labels 979392 2065027 979392 2036757 979392 1831024 979392 2398859 979392 2497110 any ideas? regards.

c++ - Is there a way to configure clang-format to keep nested namespace declarations on the same line? -

in codebase i'm working in, declare nested namespaces thusly: namespace foo { namespace detail { // stuff } } // foo::detail namespace i haven't yet been able find way configure clang-format not break out multiple lines: namespace foo { namespace detail { // stuff } } // foo::detail namespace i've played around breakbeforebraces configuration, , i've looked new bracewrapping configuration in clang 3.8, both without success. is possible without annotating code // clang-format [on/off] ? it turns out feature has been considered clang-format team, has been rejected. additional details, see https://llvm.org/bugs/show_bug.cgi?id=17928 .

excel vba - Empty cell vs empty string in imported file -

Image
in short, i'm importing csv file excel sheet , able tell difference between cell that's in csv no data, , cell isn't in csv. for example, let following text in file "test.csv" 1,2,3,4 5,,7, 9,10 13,14,15,16 then, in vba macro, load file query table (code largely copied http://www.zerrtech.com/content/excel-vba-open-csv-file-and-import ): with sheet1.querytables.add(connection:="text;test.csv", _ destination:=sheet1.range("a1")) .name = "table1" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .refreshstyle = xloverwritecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .textfilepromptonrefresh = false .textfileplatform = 437 .textfilestartrow = 1 .textfileparsetype = xldelimited .textfiletextqualifier = xltextqualifierdoublequote .textfilecons...

windows - How do I include quotes in the command inside the quotes of FOR /F -

this works fine. /f "delims=" %%g in ('tagread.exe %%l genre') ( echo %gg ) but when add sed command ('...') fails /f "delims=" %%g in ( 'tagread.exe %%l genre ^| sed -e ''/curtain^|exit^|spacer/^^!s~.*~dance~'' ' ) ( echo %%g) output: sed: newline or end of file found in pattern edit: despite loopless command succeeds: tagread.exe c:\temp\1.wma genre | sed -e '/curtain^|exit^|spacer/^!s~.*~dance~' how sed command , quotes accepted in (...) quotes? edit: dbenham said: "the single quote never needs escaped when used /f. outer single quotes delimit command string, , inner single quotes work fine." here's solution: for /f "delims=" %%g in ( 'tagread.exe %%l genre ^| sed -e '/curtain^|exit^|spacer/^^!s~.*~dance~'' ) ( echo %%g) it fails: the syntax of command incorrect. edit: here simplified , stand-alone version regarding problem: for /f ...

javascript - Fabric.js: Get text bounding box width and height -

Image
i'm using fabric.js. dimensions of rectangle (is "bounding box" correct term?) contains text (represented red box below). default fabric.js box has padding if change padding 0. i tried context fabric canvas , call .measuretext() didn't give full information needed bounding box. edit: it seems there several components of itext object: container, selection area, , text itself. in image below, itext box light blue line. selection area light blue fill. the red box need ....it's area exactly contains text ( not 1 pixel between such rectangle , extreme parts of text). methods getboundingrectheight , getboundingrectwidth (both deprecated , replaced getboundingrect believe) return height/width of outer itext container box (light blue line). note: 8 px padded box (the area between blue line , blue fill). if make padding 0, functions still don't give me need. have tried getboundingrectheight() , getboundingrectwidth() methods availab...

How to Insert Arabic data into mysql database from android -

it has android application adds data database, when enter data in arab, show "?????" . tried ways. file config.inc.php : <?php $username = "*****"; $password = "****"; $host = "*****"; $dbname = "*****"; $options = array(pdo::mysql_attr_init_command => 'set names utf8'); try { $db = new pdo("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options); mysql_set_charset('utf8'); } catch(pdoexception $ex) { die("failed connect database: " . $ex->getmessage()); } $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); $db->setattribute(pdo::attr_default_fetch_mode, pdo::fetch_assoc); if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { function undo_magic_quotes_gpc(&$array) { foreach($array &$value) { if(is_array($value)) ...

javascript - Why Are Calculate and Clear Buttons on Top of Each Other? -

Image
the 2 buttons, calculate , clear, on top of each other instead of next each other. basic calculator application (the solution appears in light green textbox after user hits "calculate"). calculate , clear buttons both inside of div tag. here full html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>calculator</title> <link rel="stylesheet" href="styles.css"> <script src="calculator.js"></script> </head> <body> <section> <h1>calculator</h1> <label> </label> <input class="nolabel" type="text" id="sum" disabled="disabled"> <br> <label>first number:</label> <input type="text" id="firstnumber"> <br> <label>second number:</label> <input type="text" id="secondnumber"> <br> <div> ...

ruby - Unable to display remote images in rails -

i using carrier wave upload images. default store_dir in image_uploader.rb file, appending store_dir image path. successful in displaying images have uploaded. however, have database remote image urls existing. these remote image urls not displayed, appending store_dir image path , not found. for eg: taking " http://myapp.com/images/i/51oyefb%2b0wl. sl160 .jpg " " /uploads/product/productimage/1/http%3a/myapp.com/images/i/51oyefb%252b0wl. sl160 .jpg " here code: _product.html.erb <% @products.each |product| %> <li> <%= image_tag(product.productimage_url) if product.productimage? %> </li> <% end %> product.rb class product < activerecord::base mount_uploader :productimage, productimageuploader end productimage_uploader.rb class productimageuploader < carrierwave::uploader::base include carrierwave::minimagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted...

python - improving heapq efficiency -

so find myself taking advantage of heapq calculations. however, problem working on, runs slow because heap gets pretty big. i thought had option speed up. rather creating giant heap, make heap of heaps. but, surprisingly me, "more efficient" code slower. there's bit more overhead in more efficient code, thought win lot. having stripped down problem, i've got 2 functions same net calculation. f1 "naive" (and faster) version. f2 "improved" (but slower) version. random number generation in both, use same seed, same thing. import random import heapq def f1(): random.seed(1) q=[0] while q: value = heapq.heappop(q) #print value if value<0.5: counter in range(16): heapq.heappush(q,value + 0.1 + (random.random()/1000)) print value def f2(): random.seed(1) q=[[0]] while q: subq = heapq.heappop(q) value = heapq.heappop(subq) #print v...

objective c - How to test interaction between WatchKit app and paired iOS App? -

i'm trying test ios app paired watchkit app (ios 9 + watchos2). far know how test them 1 one: 1) testing scheme "wkmyapp" using "my iphone + apple watch" can test out if watchkit app running on watch. 2) testing scheme "myapp" using "my iphone" can test out if ios app running on phone. however, since i'm trying use new watchconnectivity framework realize exchange of file between phone , watch, how can test them @ same time? can test them meanwhile being able see log both apps? thank you, paul

python - Apply numpy interpolation function with index array -

i have index-matrix , matrix variables of same sizes: index = [a, c, c, b] m = [0.23, 0.45, 1, 0.7] now need apply interpolation function using variables in m, based on index in index-matrix need choose different values. values interpolate between: a = [(1, 0), (2, 0.2), (3, 0.6)] b = [(1, 0), (2, 0.5), (3, 0.9)] c = [(1, 0), (2, 0.3), (3, 0.5)] so, first calculation value 0.23 , index a. need apply numpy.interp using coordinates in , on. i can zip index , m , apply numpy.interp on value value basis. since need apply huge datasets quicker way.

perl6 - Enum or symbols in Perl 6 -

i want pass parameter method may have predefined value. method send-http($url, $http_method) { .... } should create enum pass $http_method ? if how? or perl 6 have symbols in ruby? as @christoph mentioned, can use enums: enum method <get put post>; sub http-send(str $url, method $m) { * } http-send("http://url/", get); you can use type constraints: sub http-send(str $url, str $m { $m ∈ <get head post> }) { * } http-send("http://url/", 'get'); http-send("http://url/", 'put'); constraint type check failed parameter '$m' i guess use multi dispatch: multi sub http-send('get') { * } multi sub http-send('put') { * } multi sub http-send($m) { die "method {$m} not supported." } http-send('get'); http-send('post'); method post not supported.

simulation - Dynamical System in Python: Getting around Stiffness -

Image
i have been learning how use python (still beginner), , trying plot four-dimensional dynamical system (and it's stochastic equivalent). parameters, observe dynamical behavior expect. however, parameters (such below in code), encountering described "stiffness". plots seem stuck @ fixed value , sit there time (analytically, should cycle between 0 , 1). wondering if there way around this. knowledge python limited. right i'm integrating using fourth order runge-kutta though encountering same problem using odeint, , stochastic version integrated using euler-maruyama (this 1 i'm familiar , seems common 1 used). don't know if there's easy way fix this? i've been trying read online, honestly, lot of things i'm reading way beyond level of understanding of python. import scipy sp import pylab plt import matplotlib.pyplot import numpy np scipy.integrate import odeint import scipy.integrate spi #constants c13 = 6.2 c14 = 4.2 c21 = 7.3 c32 = 2.4 c34 = 12...

mysql - Optimizing Magento url rewrites -

so understood if change url of in magento, entry in core_url_rewrite table created redirects new url previous url. each time url changed, rewrites appended, not replaced. if url of changed 100 times, there 100 chained rewrites in core_url_rewrite . first of correct me if i'm wrong please. secondly, problems there if links in middle of redirect chains removed, leaving first link , last link? has done it, worth it, using existing scripts , results? at point of 100 times,.....be 100 chained rewrites in core_url_rewrite. ,you want rewrite. you changed url key of catalog/product , ticked box create permanent redirect old url. assumed changed url key my-old-product-name my-new-product-name. then, when box ticked, rewrite my-old-product-name.html my-new-product-name.html created in core_url_rewrite table. if truncate table, rewrite gone, old product url not work more.it create issue in seo if old url have crawled in google

android - SwipeRefreshLayout in fragment bigger than the tab containing it -

Image
i have tablayout inside appbarlayout, , viewpager in activity. fragments loaded inside tabs. 1 fragment has recyclerview inside swiperefreshlayout. when running, fragment occupies whole screen overlapping tabs , appbar. activity.xml <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" ...

memory - LocalBroadcastManager, android:process=":ProcessName", Too much ram usage -

alright i'm going try explain 1 problem @ time can understand issues i'm having , able tell me hoe fix it. app runs users have been complaining of high ram usage , on average runs 120mb 200mb idle agree isn't right went ahead , remembered trick used in previous project , line of code android:hardwareaccelerated="false". removes 10mb of ram per activity i'm still sitting @ 90mb of usage went , looked little harder , found android:process=":processname"> takes app using 100mb mere 8mb of ram. i'm facing problem while doing , fact have localbroadcastmanager in service activity sends data mainactivity , when these 2 have different processes don't communicate each other, , if combine them same process usage spikes yet again. i'm kinda stuck @ point , refuse use android memory debugger because doesn't tell me jack crap code doing wrong. quite literally have 5 text views , imageview inside of mainactivity know not intensive means! if ...

objective c - Getting NSInvalidArgumentException on iOS 9.0, AFNetworking 2.6.0, XCode 7.0.1 -

my app crashes initiate http request via afnetworking. crash consistent , returns following error message: 2015-10-02 14:04:40.845 app name[12130:1274441] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'data parameter nil' *** first throw call stack: ( 0 corefoundation 0x0000000104ddcf65 exceptionpreprocess + 165 1 libobjc.a.dylib 0x00000001046f7deb objc_exception_throw + 48 2 corefoundation 0x0000000104ddce9d +[nsexception raise:format:] + 205 3 foundation 0x00000001028a429d +[nsjsonserialization jsonobjectwithdata:options:error:] + 67 4 app name 0x0000000101231c28 __28-[logincontroller authuser:]_block_invoke + 328 5 app name 0x0000000101226431 __20+[user login:block:]_block_invoke215 + 113 6 ap name 0x00000001012e697b __64-[afhttprequestoperation setcompletionblockwithsuccess:failure:]_block_invoke_3 + 91 7 libdispatch.dylib 0x0000000105575ef9 _dispatch_call_block_and_release + 12 8 libdispatch.dylib 0x000000010559649b _dispatc...

javascript - recursive calls to ajax cause memory leak? -

does following code logic cause original call's stack frame contain memory each subsequent call (causing excessive memory usage)? function foo (arg) { bar(arg); } function bar (arg) { $.ajax({ success: function (data) { if (data['result'] == 'continue') { bar(data['nextarg']); } else if (data['result'] == 'done') { alert('done!'); } } }); } your code not recursive. $.ajax asynchronous, stack pointer isn't waiting bar return. instead, $.ajax fires asynchronous process, continues until hits either explicit or implicit return. in case, there implicit return @ end of bar . your function consumes no more memory should. function bar (arg) { // calls $.ajax, async, fires "whenever" $.ajax({ // when ajax complete/successful, function called success: function (data) { if (data['result'] == 'continue...

How do I redirect apache on Ubuntu server to serve the index.php file? -

i found similar question on stack overflow , tried following directions specified there redirecting request example.com load /var/www/example.com/public_html/index.php i trying setup friendly urls. on ubuntu, have vhost file inside /etc/apache2/sites-available/example.com.conf if put directoryindex index.php in there, fails restart apache. use a2ensite command on ubuntu create simlink sites-enabled directory. i tried putting directoryindex index.php index.html index.pl in /etc/apache2/mods-available/dir.conf file still doesn't load php file exists in directory /var/www/example.com/public_html , try load example.com in browser. read somewhere posting on stack overflow should use example.com in place of actual domain name. i found post on using .htaccess file redirect index.html index.php. trying achieve have example.com serve index.php. logic suggested if edit /etc/apache2/mods-available/dir.conf , put index.php first , put other file types, mime-types after that...

php - Box/Spout questions -

Image
this first time using box/spout library. using wamp server. question following: require_once('./spout-master/src/spout/autoloader/autoload.php'); use box\spout\writer\writerfactory; use box\spout\common\type; $filepath = 'test.xlsx'; $writer = writerfactory::create(type::xlsx); $writer->opentofile($filepath); [x] $writer->addrow(['a'], $style); $writer->close(); (1) when running above code, following error message: warning: rmdir(c:\windows\temp/xlsx560f58d588ceb): permission denied in c:\wamp\www\1300.revenue.com.my\public_html\spoutmaster\src\spout\common\helper\filesystemhelper.php on line 113 what errors means , how should modify prevent error message appeared? (2) want make expected output below: but didn't know how write on [x] part. how write in order expected output? it looks default temp folder used generate xlsx file cannot deleted. can verify checking permissions on c:\windows\temp/xlsx560f58d588ceb...

node.js - npm install mongoose causes gyp and kerberos errors (gssapi/gssapi.h file not found) -

ubuntu 14.04 nodejs version v4.1.1 installed these commands: curl -sl https://deb.nodesource.com/setup_4.x | sudo -e bash - sudo apt-get install -y nodejs mongodb installed via mongodb docs tutorial next tried installing mongoose doing sudo npm install mongoose i received following error: > kerberos@0.0.14 install /root/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos > (node-gyp rebuild) || (exit 0) gyp err! build error gyp err! stack error: not found: make gyp err! stack @ f (/usr/lib/node_modules/npm/node_modules/which/which.js:73:28) gyp err! stack @ e (/usr/lib/node_modules/npm/node_modules/which/which.js:76:29) gyp err! stack @ /usr/lib/node_modules/npm/node_modules/which/which.js:84:16 gyp err! stack @ fsreqwrap.oncomplete (fs.js:82:15) gyp err! system linux 3.13.0-57-generic gyp err! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js...

Finding the instance of a specific string and first 2 letters of next string and switch their places in php -

i have specific string is: <span style="color: green;"> i want function finds instance of string , further finds whether next string's first 2 characters i have idea of searching character character, take long. there shorter solution it? input: ab <span style="color: green;"> </strong> output: ab </strong> <span style="color: green;"> the strong tag example, /b, /i, /li or other closing tag. you can use preg_replace this, i.e.: $myhtml = <<< lol ab <span style="color: green;"> </strong> lol; $myhtml = preg_replace('%(<span style="color: green;">)(?:\s+)?(</.*?>)%i', '$2 $1', $myhtml); echo $myhtml; //ab </strong> <span style="color: green;"> it work tag comes after span. demo: http://sandbox.onlinephpfunctions.com/code/9dc934ece66856a92b041114140982dc822a6bec

xaml - Drawer Navigation not working sometime in Windows phone 8.1[RT] -

i working drawer layout found code msdn have 6 pages in application , page contains drawer , have initialize drawer in each page public page1() { drawerlayout.initializedrawerlayout(); drawerclass drawer = new drawerclass(); //contains drawer data , text , image listmenuitemsdrawer.itemssource = drawer.initlizedrawerdata(); string picuri = constant.profileimage + constant.localsettings.values["profile_image"].tostring(); imgprofilepic.imagesource = new bitmapimage(new uri(picuri, urikind.relativeorabsolute)); tbdrawermembername.text = constant.localsettings.values["name"].tostring(); } same in page2,page3... contractor ,when navigate page1 page2 , page2 page1 (same 2 or 3 times) application exit (not crash) has exited code 0 (0x0) have test code in nokia lunia 520

android - Listview weird reaction on Clicking -

i'm displaying listview custom adapter. each item of list view has photo (imageview) , (flipimageview) button , textview show number of likes. have populated listview 3 items. weird issue when click on button of second photo, there no response (no flipping of image , no change in number of likes). instead first photo button responds , number of likes of first photo got incremented. second weird issue that, first item of listview isn't populated (an imageview lies blank while imageview of other list items inflate fully). when scroll , come first item, gets inflated fully. here adapter code, xml file of each list item, , listview itself. how solve these issues? class postadapter extends arrayadapter<eachpost> { arraylist<eachpost> posts; viewholder vholder; string root = environment.getexternalstoragedirectory().tostring(); file dir = new file (root + "/fishograph/.feed"); public postadapter(context context, int resource, arraylist<each...

delphi - Add a TCombobox Column to a Firemonkey TGrid -

this question appears have been answered already, possibly monkeystyler/mike sutton, however, using delphi 10 seattle, provided code , guides don't work anymore. firemonkey grid basics doesn't work because applystyling event handler called once (at column create) i want add tcombobox or tcomboboxedit column atgrid. type tcombocolumn = class(tcolumn) protected function createcellcontrol: tstyledcontrol; override; // works! end; ... grid1.addobject(tcombocolumn.create(grid1)); ... function tcombocolumn.createcellcontrol: tstyledcontrol; begin result := tcombobox.create(self); tcombobox(result).items.add('a'); tcombobox(result).items.add('b'); tcombobox(result).items.add('c'); tcombobox(result).onchange := dotextchanged; // strange hooks end; this creates combobox column in grid, it's same combobox in every row, , have no idea how add getvalue , setvalue methods applicable here...

Android: simple format input number -

this question has answer here: edittext currency format 2 answers i'm learning android. have edittext input money, , if enter input number 1000, result must 1.000, , if enter input 1000000, result must 1.000.000. while i'm typing, every 3 characters last beginning must have ".". you can use inputfilter public class currencyformat implements inputfilter { pattern mpattern = pattern.compile("(0|[1-9]+[0-9]*)?(\\.[0-9]{0,2})?"); @override public charsequence filter(charsequence source, int start, int end, spanned dest, int dstart, int dend) { string result = dest.subsequence(0, dstart) + source.tostring() + dest.subsequence(dend, dest.length()); matcher matcher = mpattern.matcher(result); if (!matcher.matches()) return dest.subs...

r - modified sankey Plot with several edges between nodes -

Image
i make modified sankey plot in r, possible have several edges between nodes, identify different paths. bit hard explain made sample picture in ppt :) i know ugly :) point able make edges between , b1, , indicate edge belongs path going c1 , c2. i tried sankeyplot rcharts-packages, 2 columns of nodes. i have tried riverplot-packages, here can not make 2 edges between same nodes. you can use diagrammer graphviz graph , html table labels: library(diagrammer) g1 <- 'digraph structs { b1_node [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td port="one">b one</td></tr> <tr><td port="two">b two</td></tr> </table> > ]; -> b1_node:one; -> b1_node:two; -> b2; b1_node:one -> c1; b1_node:two -> c2; b2 -> c3; rankdir=lr }' grviz(g1) see diagra...

java - Error when trying to create swipe view With tab bar -

i'm new andoid , trying create swipe view tab bar in android. tabpageradapter import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentstatepageradapter; public class tabpageradapter extends fragmentstatepageradapter { public tabpageradapter(fragment manager fm) { super(fm); @override public fragment getitem(int i) { switch (i) { case 0: return new information(); case 1: return new workforce(); case 2: return new workdetailstable(); } return null; } @override public int getcount() { // todo auto- generated method stub return 3; //no of tabs can give number of tabs } ...

machine learning - Is there a layer in Caffe that can get an arbitrary sub block in a blob? -

is there layer in caffe can arbitrary sub block in blob? afaik there not general slicing layer in caffe. if want extract sub-blocks specific channels of blob, can use "slice" layer. depending on requirements, might find "crop" layer sufficient needs. if need more flexible access sub-blocks, might want consider using "python" layer. an example using "crop" layer pointed out "crop" layer expects 2 "bottom"s since second 1 used reference shape, can produce using "dummydata" layer. suppose want select x[:,:,3:20,5:40] , 17x35 crop layer { name: "ref_shape_17x35" type: "dummydata" top: "ref_shape_17x35" dummy_data_param { shape { dim: 1 dim: 1 dim: 17 dim: 35 } } } layer { name: "crop_x" type: "crop" bottom: "x" bottom: "ref_shape_17x35" top: "crop_x" crop_param { axis: 2 # not cro...

Travelling around pixels c# -

i want travel around black pixel ( inmasca1 ) until finds pixel different black. want search on row , column, not diagonally. after colored pixel in finded, assign black 1 colour. tried till now. private bool inmasca1(color col) { return col.r == 0 || col.g == 0 || col.b == 0; } bitmap b = (bitmap)picturebox1.image; (int = 0; < b.width - 1; i++) { (int j = 0; j < b.height - 1; j++) { nou = b.getpixel(i, j); if (inmasca1(nou)) { (int l = 0; l < j; l++) { if (!inmasca1(b.getpixel(i, j + l))) { z0 = j + l; break; } else { if (!inmasca1(b.getpixel(i, j - l))) { z0 = j - l;...

javascript - PHP : Get values outside of foreach -

i have nested foreach loops in html table : @foreach ($getusers $key => $commits) @foreach ($commits->getlinks $key1 => $links) <tr> <td> <input type="hidden" name="" id="applicant_id" value="{{$commits->id}}"> <td> <tr> @endforeach @endforeach next have form need id of row defined in hidden field in foreach loop above. below in form have have hidden input field p ushing foreach hidden filed value form hidden field value but gives 1 id (same id every table row) . jquery getting id foreach hidden input to form hidden input : $(document).ready(function(){ var applicant_id = $('#applicant_id').val(); $("#applicant").val(applicant_id); }) form <form class="form-horizontal" method="post" action="{{route('upload-agreement')}}" enctype=...