Posts

Showing posts from August, 2010

javascript - How to apply jquery ellipsis to div -

$('.more2').each(function() { var showchar = 150; var content = $(this).html(); if(content.length > showchar) { var c = content.substr(0, showchar); var h = content.substr(showchar, content.length - showchar); var html = c + '<span class="moreellipses">' + ellipsestext+ ' </span><span class="morecontent"><span>' + h + '</span> <a href="" class="morelink">' + moretext + '</a></span>'; $(this).html(html); } }); i trying build jquery accordion effect div drop down; please see example jsfiddle . here want it's on-clicking of ('+') button want show reaming part of content. @ time else div in same row should take same height active div taken don't want show content in inactive div. try adding document ready: $('a.morelink').click(function(){ $(...

ios - To get images from device and show images in uicollectionview -

i have images device these links mutiselectimagepicker and elcimagepickercontroller i have tried both links , works good. when click on done button path looks this <uiimage: 0x7fca78772510>, {485, 303} but how can selected images collection view , how can print selected images paths... what printing description of uiimage object, contains address of memory image resides , size. uiimage s don't have path because object created in heap memory, can created file doesn't bring information. once have uiimage instance can pass image property of uiimageview , not path needed.

Referencing overlapping arrays through pointers -

Image
i need perform memmove() -style operation pointers tuned overlapping arrays. more precisely, need copy b(:) a(:) . in c programming language have called memmove(a, b, n) . but, far know, fortran standard strict when comes pointer aliasing. so, of following 3 options safe use (according standard), , result in undefined behaviour: vector syntax aliased pointers (option 1), explicit do-loop aliased pointers (option 2), call routine takes overlapping arrays arguments (option 3) ? program ptr implicit none integer, parameter :: array_size = 10, n = 6 integer, target :: array(array_size) integer, dimension(:), pointer :: a, b integer :: => array(1: n) b => array(3: n+2) ! option 1 a(1: n) = b(1: n) ! option 2 = 1, n a(i) = b(i) end ! option 3 call foobar(a, b, n) contains subroutine foobar(a, b, length) integer, dimension(:), intent(out) :: integer, dimension(:), intent(in) :: b integer, intent(in) :: le...

Failed to startup Jboss 5.1 -

i on redhat , using jboss 5.1 not able start jboss. working added jar file in lib. throwing error saying failed boot jboss: java.lang.nullpointerexception at org.jboss.main.boot(main.java:136) at org.jboss.main$1.run(main.java:556) at java.lang.thread.run(thread.java:745) what can possible cause of ???

php - How to change the url without refreshing or reloading page on when radio button checked? -

question: want change url of page without refreshing when checked on radio button page refreshes , change url. example, my current page url is: www.example.com/cart/ when checked pickup, day , time radio button page refresh , shows url: www.example.com/cart/?method_choice=pickup&time=12pm-3pm&day=tue but want page not refresh , url change when radio button checked. you wanting page refresh? // reloads current page document.location.reload(); // go page window.location = "http://www.example.com/cart/?method_choice=pickup&time=12pm-3pm&day=tue";

linux - Architecture based OpenSSL package to be removed -

i trying build rpm using source code of open source tool. while doing , see below error : gcc -o9 -march=x86-64 -wall -wmissing-prototypes -wpointer-arith -wdeclaration-after-statement -wendif-labels -fno-strict-aliasing -fwrapv dbutils.o config.o repmgrd.o log.o strutil.o -l/opt/app/ionix/smarts-ncm/db/controldb/lib -lpgport -l/opt/app/ionix/smarts-ncm/db/controldb/lib -lpq -l/opt/app/ionix/smarts-ncm/db/controldb/lib -wl,-rpath,'/opt/app/ionix/smarts-ncm/db/controldb/lib',--enable-new-dtags -lpgport -lpam -lssl -lcrypto -lz -lreadline -ltermcap -lcrypt -ldl -lm -o repmgrd /usr/bin/ld: **cannot find -lssl** upon doing research , understood it's because there multiple openssl packages ( different architecture ) installed on machine : rpm -qa --queryformat '%{name}\t%{arch}\n' | grep openssl openssl097a i386 openssl x86_64 openssl i686 the question , openssl package can remove here , how ? there many dependencies might affect other packages well. h...

linux - Provide root access but not DB access -

trying give servers production access more ops people in our team. issue db access concern. tasks ops not need db access , limited people should have such access. let's have 2 servers: application server: tomcat (app needs access db server) db server: database so give root access "application server" ops can sorts maintenance on server not able gain access db server. means cannot store db pass in configuration files app read example. are there known practices solve issue that? first credential 'application server' has access 'db server' should considered handed on root on application server. since db access must limited cannot give ops complete root on application server. but not lose hope, there sudo . sudo can give users or groups access root power, limited purposes. unfortunately setting sudo correctly can tricky prevent subshells , wildcards getting full root, possible. there many permutations general answer beyond sudo ...

android - Custom ActionBar resulting in overlapping default ActionBar -

Image
hello wanted add custom actionbar application in android using method: linearlayout ll_q = (linearlayout) findviewbyid(r.id.qtitlebar); getsupportactionbar().setdisplayoptions(actionbar.display_show_custom | actionbar.display_use_logo); getsupportactionbar().setcustomview(r.layout.question_titlebar); the result is: how rid of grey area in actionbar , menu button? if using android studio following: extend class activity instead of actionbaractivity. open app's manifest file , change android:theme="@android:style/theme.black.notitlebar.fullscreen"

c++ - CLion can't find CMake generated headers? -

going through cmake tutorial : ├── cmakelists.txt ├── src │   └── main.cpp └── templates └── fooconf.h.in cmakelists.txt cmake_minimum_required(version 3.2) project(foo) set(cmake_cxx_flags "${cmake_cxx_flags} -std=c++11") set(project_source_dir src) set(project_template_dir templates) set(source_files ${project_source_dir}/main.cpp) set(${project_name}_major 0) set(${project_name}_minor 1) set(${project_name}_micro 1) configure_file ( "${project_template_dir}/fooconf.h.in" "${project_source_dir}/fooconf.h" ) add_executable(foo ${source_files}) templates/fooconf.h.in #define @project_name@_version_major @project_name@@_version_major@ #define @project_name@_version_minor @project_name@@_version_minor@ #define @project_name@_version_micro @project_name@@_version_micro@ src/main.cpp #include <iostream> #include "src/fooconf.h" // tried: "fooconf.h" int main() { std::cout << foo_version_major;...

Can I have multiple link relations with the same URI in HATEOAS? -

i have resource, in case: http://www.domain.com/sales-rep/{id} each sales representative has multiple products can sell. uri resource be: http://www.domain.com/sales-rep/{id}/products the problem is, depending on user's permissions, might able get or get , put against resource. my problem designing link relations when retrieving sales rep resource. example json follows: { firstname : "dave", lastname : "matthews", links : [ { rel : "self", href : "http://www.domain.com/sales-rep/dmat1" }, { rel : "products", href : "http://www.domain.com/sales-rep/dmat1/products" } ] } if take approach, link relation named noun representing resource. doesn't communicate client whether can edit resource or not. far i'm aware http methods in links not part of spec & these responsibility of documentation, how communicate permissions? { firstname : "dave", las...

gis - Representing a Fan Shaped Image on a Map using Python -

Image
i looking display object (fan shaped object each protruding line @ 'id angle' vertical) on map using below table input: table (input): fan shaped object: i able display point on map using python (very easy). problem far has been coming way represent each protruding line per above object. i appreciate help. update please see below: import matplotlib.pyplot plt longitude = [4.3323, 4.3323, 4.3323] latitude = [2.3433, 2.3433, 2.3433] x,y = map(longitude, latitude) map.plot(x, y, 'bo', markersize=18) plt.show() so have been able represent these data points point. i need integrate directional improvements earlier stated. try this: import numpy np import matplotlib.pyplot plt center = (4.3323, 2.3433) angles = [60, 120, 240] angles = [a/180.0*np.pi in angles] # scale l = 1 # center point x, y = center # draw each line in angles: dx = l * np.sin(a) dy = l * np.cos(a) plt.plot([x, x + dx], [y, y + dy], 'k-') # draw ce...

asp.net web api - Get error when I try to make AJAX POST call -

i create view in action page: public class homecontroller : controller { public actionresult index() { viewbag.title = "home page"; return view(); } } at point in view make post call another controller using ajax: function save() { if (sensordata) { $.ajax({ url: '/../sensor/savedata', type: 'post', contenttype: 'application/json', datatype: 'json' }); } else { alert("no data."); } } this code of api controller: public class sensorcontroller : apicontroller { public ihttpactionresult savedata() { try { return ok(); } catch (exception) { return badrequest("data not saved"); } } } but error: "networkerror: 404 not found - http...

Select value from stored procedure which outputs a table -

i have procedure returns select statement output after set of calculation. output on executing procedure below: exec proc1 empid output below col1 col2 col3 col4 col5 2014 2 33 330 29 2014 3 10 34 12 2015 1 25 60 55 now have main select statement gets many columns joining different tables. i need retrieve above columns (output of stored procedure proc1 ) main select statement, empid available. something below: select empid, empname, empsal, (select col3 [exec proc1 empid] col2=1), empdept tblemployee is possible do? expecting 25 in 4th column of above query. you can use either user-defined function or view instead of stored procedure. sp doesn't allow select use in it. or can create table variable store result returned stored procedure declare @temptable table (...)--declare columns insert output of stored proc table variable , then insert @temptable exec sto...

java - How to check whether a file already exists in Dropbox -

i using following code upload file dropbox. want check if file exists on dropbox already, avoid duplications. how can check if file exists or not? new android, don't know now public class uploadfiletodropbox extends asynctask<void, void, boolean> { private dropboxapi<?> dropbox; private string path; private context context; public uploadfiletodropbox(context context, dropboxapi<?> dropbox, string path) { this.context = context.getapplicationcontext(); this.dropbox = dropbox; this.path = path; } @override protected boolean doinbackground(void... params) { final file tempdir = context.getcachedir(); file tempfile; filewriter fr; try { tempfile = file.createtempfile("file", ".txt", tempdir); fr = new filewriter(tempfile); fr.write("test file uploaded using dropbox api android"); ...

javascript - Object returning as undefined -

if call find function app.count() ok getting correct result when call app.add() getting this.basket undefined. don't why happening? var app = (function() { var basket = [ { id: 100, price: 10, description: '', name: 'item one', quantity: 10, url: '' }, { id: 200, price: 20, description: '', name: 'item two', quantity: 15, url: '' } ], find = function(item) { for(var = 0; < this.basket.length; i++) { if(this.basket[i].id === item) { return } } return null }, add = function(item) { var itemfound = find(item) }, count = function() { var total = 0; for(var = 0; < this.basket.length; i++) { total = total + this.basket[i].quantity } return total }; return { basket: basket, find: find, add: add, count: count }; })(); app.count() /* works */ app.add() /* returns th...

mongoose - How do i get all keys in Mongodb collection? -

i saw few solutions not exact solution. have db name results , collection name marks below: db.marks.find(); { "_id" : objectid("54f57522627af4bfdcf79764"), "name" : "john", "scroe1" : 23, "score2" : 21, "score5" : 12 } { "_id" : objectid("54f5761a627af4bfdcf79765"), "name" : "mike", "scroe2" : 22, "score3" : 20, "score4" : 22 } { "_id" : objectid("559d0bc521cb2e056507c3e3"), "name" : "bush", "score2" : 30 } i tried with var doc=db.marks.findone(); (var key in doc) print(key); and got _id name score1 score2 score5 but want keys in collection below: _id, name, score1, score2, score3, score4, score5 name scroe1 score2 score3here findone return first found document. since first document list not have score3 , score4 keys, not display them. if want show root-level keys acr...

playframework - Mobile Chat Backend Play Framework vs Netty -

i want develop mobile chat backend android , ios clients. have experience in playframework 2 java. need learn , use netty framework chat backend? playframework nio framework running on netty. can not decide 1 choose? playframework enough high traffic mobile chat backend? the play framework should enough. no need touch bare metal (netty) unless doing complicated (special protocols, etc.). use case, need familiarize websocket protocol , how set them in play . your next step setup clients android , ios. android take @ java-websockets , while im not familiar ios, google search returned this might somewhere start. all being said if you'd avoid fluff play provides (sessions, cookies, templates, routing, asset managment, akka, etc.) , dont think ever need them, go netty if time learn non-issue. note netty client libraries above still apply if use same websocket protocol.

ios - Ipad is not showing directory created with phonegap -

i created 1 directory using: window.requestfilesystem(localfilesystem.persistent, 0, function (filesystem) { filesystem.root.getdirectory("folder1", {create: true}, function (dir) {}); }); however, directory not displayed on ipad. have tried using file manager, directory not displayed well. can me solve issue?

asp.net mvc - Bypass ASP MVC bundle requests from MVC module -

i have httpmodule in place url encryption; noticed module intercepting mvc bundle requests; if using following settings: <modules runallmanagedmodulesforallrequests="false"> <add ..precondition="managedhandler" /> </modules> is there way bypass interception of mvc bundle requests httpmodule? so ignoring route in httpmodule can use application_beginrequest or application_endrequest , below in example ignores aspx pages or check path want ignore example : private void application_beginrequest(object source, eventargs e) { httpapplication application = (httpapplication)source; httpcontext context = application.context; string filepath = context.request.filepath; string fileextension = virtualpathutility.getextension(filepath); if (fileextension.equals(".aspx")) { return; } } but if functionality related modules of application suggest make us...

matlab - how to step forward a simulink model programmatically -

i have simulink model, want step forward programatically. there way it? tried set_param('model','simulationcommand','step') didn't work. the way can see run simulation in debugging mode using sldebug . more information, see debugging in simulink documentation.

How to get the offset of a text in HTML tag and all the parents to the root tag in PHP? -

i extract article example publicationyear, title , authors this: $aut = $xpath->query("//table[@cellpadding='6']//b[1]"); $authors = array(); foreach($aut $node) $authors[] = $node->nodevalue; $title = $doc->getelementsbytagname('h3')->item(1); $publicationyear = $xpath->query("//p[1]//text()[(following::br)]")->item(0)->nodevalue; $aux = $xpath->query("//p[2]//text()[(preceding::br)]"); $doi = substr($aux->item($aux->length - 1)->nodevalue, 4); for strings(the full name, year, title) need tags come before : form1_table3_tbody1_tr1_td1_table5_tbody1_tr1_td2_p2 and position in tag start: 163,end: 190. know informations grouped in tags, need index of tag if has siblings that's why example has table 3 third son of forum 1. if there's way of doing in php or @ least javascript update in te article have: ... <td valign="top"> <h3 class="blue-space">...

mule process csv file with same set of data -

in mule have csv file containing 50 rows of records product id, product name, quantity, price, offer, expire date. want convert csv format json format , use external api using above data. while in mid calling, api network goes down. how can retry same data. can shed light on this you have create exception catcher log failure requests, run through again. do not keep "looping" same record until api comes up. block others being processed , queue not decrease. see this post explains how setup batch jobs , this post on how create error handlers; both mulesoft blog.

javascript - How render a route relevant subheader with meteor blaze? -

the end result of of go on subheader not rendering on screen want to. currently there mongo collection subheader category field , texth field. subheader = new mongo.collection('subheader'); meteor.methods({ subheaderinsert: function(subheaderidattributes) { check(string); check(subheaderidattributes, { texth: string, category: string }); var subheaderid = _.extend(postattributes, { submitted: new date() }); var subheaderid = subheaderid.insert(subheader); return { _id: subheaderid }; } }); there route subscribes subheader , other page data. router.route('/', { name: 'home', controller: missionstatementpostcontroller, waiton:function () { return meteor.subscribe('subheader', 'home'); } }); the publish function appears work fine. meteor.publish('subheader', function(cat) { return subheader.find({category: cat}); }); the correct doc mongodb collection reaching client. c...

Dojo Tree Search Filters -

in 1 of projects have used dojo tree plugin using itemfilewritestore & foreststoremodel. i have achieved dnd, contextmenu & tool tip on tree view. can't figure out how search node or child node in tree. i looking similar kind of implementation ( http://jsfiddle.net/slemmon/fsjwf/2/ ), seems implemented in other library. could please me how implement same in dojo. below code: var store = new dojo.data.itemfilewritestore({ data: data }); var treemodel = new dijit.tree.foreststoremodel({ rootid: "id", rootlabel: "label", store: store, breadcrumb : 'bcinfo', childrenattrs: ["children"] }); var treecontrol = new dijit.tree({ model: treemodel, dndcontroller: "dijit.tree.dndsource", persist: false, showroot: false, onmouseout: function(e){ var node = dijit.getenclosingwidget(e.target); dijit.too...

ios - SwiftyJSON showing progressHUD at completion -

i having difficulty displaying progresshud when parsing json using swiftyjson app seems crash if not wait few seconds after showing progresshud. it not crash if wait few seconds after progress bar disappears means must doing wrong dispatch async queue. unsure of completion handler swiftyjson after parsing api. the cause of crash array index out of range data not loaded yet. override func viewdidload() { super.viewdidload() mbprogresshud.showhudaddedto(self.view, animated: true) dispatch_async(dispatch_get_main_queue()) { self.parseapi() mbprogresshud.hidehudforview(self.view, animated: true) self.mytable.reloaddata() } } func parseapi() { let url = nsurl(string: "https://www.kimonolabs.com/api/e0uyfycg?apikey=7v9fhvawkgaspmtvwotnviwzmwipyj0f") let datafromnetwork = nsdata(contentsofurl: url!) let json = json(data: datafromnetwork!) } you should parse api in background thread, otherwise parse on main thread...

c - How to obtain addresses of structure members -

i'm doing testing of project based on cortex-m0. firmware developed in c using keil (v. 4.71.2) , arm linker (v. 5.03). have read/write access ram use simulate failures, , need find out addresses of variables need modify. right i'm using linker map file handy scalar global variables: myvar 0x00005978 data 4 file1.o(.constdata) here know writing 4 bytes @ address 0x00005978 alter variable myvar . however, cannot apply same approach global structures: mystruct 0x00020000 data 400 file2.o(.data) i have start address of mystruct , however, have troubles access mystruct.module2.config.myvar . since code still being developed, new fields added mystruct.module1 , address of mystruct.module2 changes. is possible force linker output addresses of individual fields in structure? as workaround declare global variable address want: uint32_t * const myvar_ptr = &mystruct.module2.config.myvar; then can find address of myvar_ptr in linker m...

android - Java Scope Questions from a C++ background -

i'm working on first android app coming 2 years of c++ school. the code looks this: double total = 100000000000l; for(long = 0l; < diff; i++) { total += 1.8; } countview.settext(numberformat.getinstance().format(total)); final handler handler = new handler(); handler.postdelayed(new runnable() { @override public void run() { if (total += 1.8 < 200000000000l) { handler.postdelayed(this, 1000l); return; } handler.removecallbacks(this); } }, 1000l); in c++, i'd able reuse total variable no problem - it's in same scope. in java i'm getting error message i'm attempting access inner class. trying declare total public or static gives error modifier isn't allowed here. why can use total right below declare not several lines down? in java, if want access members of enclosing class (i.e. total in example) local class runnable in example, these members have declared final...

arrays - VBA compare Abs() values not working -

i have 2 arrays of data want compare every element in both arrays , put biggest absolute value in new array. see code below: if abs(dataarray1(i)) < abs(dataarray2(i)) newdataarray(i) = dataarray2(i) else newdataarray(i) = dataminarray(i) end if the probem of values decimals , if compare example -1.02 , 1.0100 normaly -1.02 has bigger abs value. in case program returns 1.0100 , happens values not same length. longer 1 returned. how happen , wrong? are arrays of string type? otherwise couldn't explain why values 1.0100 exist. value should automatically shown 1.01 if working strings try convert values floats. work: abs(cdbl(dataarray1(i))) < abs(cdbl(dataarray2(i)))

sequelpro - Error executing MySQL code -

i using sequel pro , mysql. when execute each line individually no errors generated , code works expected. when try execute lines error below. delimiter $$ create temporary table pricesoutput (price float, namex varchar(255), updatedat datetime); insert pricesoutput select 9.99, 'bosch zxy', '12/05/12'; select * pricesoutput; drop table pricesoutput; end$$ delimiter; [error in query 1] have error in sql syntax; check manual corresponds mysql server version right syntax use near 'insert pricesoutput select 9.99, 'bosch zxy', '12/05/12'; select * pr' @ line 3 [error in query 2] have error in sql syntax; check manual corresponds mysql server version right syntax use near 'delimiter;' @ line 1 the delimiter $$ line changes delimiter ; $$, each line needs terminating $$ instead. end used defining procedures not required & final delimiter; should have space before semi-colon. delimiter $$ create temporary table ...

c++ - Undefined references during linking when compiling with clang, but not with gcc -

i'm working on quite large c++ project, , have option compile either clang (3.6) or gcc (5.1). now project produces executable, uses quite bit of shared libraries (which built part of project). now when compile gcc, fine , working executable. however, when compile clang, linking errors when linking executable: /home/{user}/projects/60channelsip/bin/clang/opt/swmi/lib/libsystem.so: undefined reference `boost::program_options::arg' /home/{user}/projects/60channelsip/bin/clang/opt/swmi/lib/libmysql.so: undefined reference `mysqlpp::query::str(mysqlpp::sqlqueryparms&)' /home/{user}/projects/60channelsip/bin/clang/opt/swmi/lib/libtfc.so: undefined reference `std::ios_base::failure::failure(char const*, std::error_code const&)' /home/{user}/projects/60channelsip/bin/clang/opt/swmi/lib/libtfc.so: undefined reference `boost::gregorian::greg_month::get_month_map_ptr()' the strange thing libraries references compile , link fine, , required libraries linker...

javascript - Why is the parenthesis missing in this anonymous function call? -

this question has answer here: what difference between 2 declarations of module in javascript? 3 answers i reading book , has code example function getfunction() { var result = []; (var = 0; < 10; i++) { result[i] = function(num) { return function() { console.log("this " + num); } }(i); }; return result; } it working ok why anonymous function here not wrapped in parenthesis (function(...))(i); ? , in cases can parenthesis omitted in anonymous function? since syntax function declarations , function expressions identical, js tells 1 using code around function. to stop being function declaration need use in expression. wrapping in parenthesis will preceding = (as host of other operators). since there = here, parenthesis unnecessary.

ruby - How to gsub with wild characters (for spaces) -

i need replace combo of 2 words combo disregarding number of spaces between them, possible kind of wildcards in single line ? text.gsub(/create proc/i,"delete proc") ## single space text.gsub(/create proc/i,"delete proc") ## 2 spaces text.gsub(/create proc/i,"delete proc") ## 3 spaces text.gsub(/create\s+proc/i,"delete proc") the \s escape code match on whitespace (spaces , tabs) http://rubular.com/r/0bqvubnojc

swift - Simulating a UINavigationController Pop -

i'm using navigation controller , works great. however, custom buttons segue new viewcontrollers (not in stack) , don't push-type transition animation uses. goal: want transitions (described above) mimic nav-stack pop transition (where current view slides right, revealing view underneath). i've simulated nav-pop using below code, after buttons , nav-bar button super glitchy. @ibaction func page2_to_page1_butpush(sender: anyobject) { var curpage: uiviewcontroller = self.storyboard!.instantiateviewcontrollerwithidentifier("page2_id") as! uiviewcontroller var prevpage: uiviewcontroller = self.storyboard!.instantiateviewcontrollerwithidentifier("page1_id") as! uiviewcontroller self.navigationcontroller?.pushviewcontroller(prevpage, animated: false) self.navigationcontroller?.pushviewcontroller(curpage, animated: false) self.navigationcontroller?.popviewcontrolleranimated(true) } can supply simple way make segues simulate na...

Creating c++ DLL including third party SDK -

i trying third party reconstruction library reconstructme working creating c++ dll , call within unity(c#). i have working using supplied dll calling unmanaged function calls hitting performance on every update multiple functions e.g: on every update calling below necessary calls: reme_sensor_grab reme_sensor_prepare_images reme_sensor_track_position reme_sensor_update_volume reme_surface_generate for optimization, idea if can make new dll including above functions, calls , dll import function call once per update unity(c#) or may call once , data callbacks. i have used below code check if able working, unfortunately getting lnk2019: remedll.obj : error lnk2019: unresolved external symbol __imp_reme_context_create referenced in function “private: void __cdecl remedll::startscan(void)” (?startscan@remedll@@aeaaxxz) 1>c:\projects\remedll\x64\debug\remedll.dll : fatal error lnk1120: 1 unresolved externals #include <iostream> #include <reconstructmesdk/reme.h...

javascript - Laravel Ajax panel -

my problem when bring mouse on 2nd page button link shows in monitor down left corner this: home/?page=2 need show this: ajax/comments/?page=2 . shows ajax/comments/?page=2 when press button go 2nd page , after starts work. <div class="row content col-md-9"> <div class="panel panel-default widget"> <div class="panel-heading"> <span class="glyphicon glyphicon-comment"></span> <h3 class="panel-title"> recent comments</h3> </div> <div class="panel-body"> <ul class="list-group"> @foreach($comments $comment) <li class="list-group-item"> <div class="row"> <div class="col-xs-2 col-md-1"> <img src="{{$comment->author-...

java - How to convert cases with bit manipulation? -

how can convert uppercase lowercase , vice versa using bit manipulation? in ascii, uppercase characters prefixed 010 , 1-26 in binary [their location in alphabet]. lowercase prefixed 011. by using bitwise or operand , 00100000 mask 0b00100000, 32 integer, can convert uppercase lowercase, , not change lowercase. example char character = 0b00100000 | 'a'; or char character = 32 | 'a'; to convert uppercase, use char character = 0b01011111 & 'a'; or char character = 95 & 'a'; you may use way of representing 127 or 95 bitmask , operation.

synthesis - How to find high fanout nets in VCS? -

in timing report of synthesis synopsys vcs, warning states: warning: design contains 8 high-fanout nets. fanout number of 1000 used delay calculations involving these nets. (tim-134) how can find offending nets? there report can use find these high-fanout nets? edit: posted @ https://electronics.stackexchange.com/questions/179201/how-to-find-high-fanout-nets

checkbox - keeping multiple checkboxes checked in foreach loop in php -

i have multiple checkboxes within foreach loop , need keep selected checkboxes checked after form submission. code below. please help. <? $i=0; while ($row=mysql_fetch_array($result,mysql_assoc)) { foreach($row=$val) { $id="chkbox".$i; ?> <input type="checkbox" name="chkbx" onclick ="func()" id="<?echo $id;">? value="<?echo $val \n;?>" <? echo "$val";?> now , how include checked property of boxes.. you don't need foreach loop here this can done checking multiple checkbox checked <?php $i=0; while ($row=mysql_fetch_array($result,mysql_assoc)) { $checked = ""; if($row['database_column_name']=$val){ $checked = "checked"; } echo ' <input type="checkbox" name="chkbx" onclick ...

Regex Replace Unique Using VB6 -

how replace using regex? for example. string d + width / 2 if try replace d 1 output 1 + wi1th / /2 . how replace d only, , exclude d of width? \bd\b should you. \b word boundary

jaxb - How to get the root element in Moxy -

i trying create xml analyzing xsd using moxy. not aware of how xsd looks like. xsd provided on fly. using moxy able load xsd , print details of xmldescriptors. question is, how identify root element. thanks having xsd, global type can root element of xml document. such global type, use method org.eclipse.persistence.oxm.xmldescriptor#getdefaultrootelement to name of root element.

android - Global variables not passing properly -

i have created class holds common variables , functions , inherited activity classes interface different ui pages in app. have been passing information between classes , activities using getvariable() , setvariable(input ) functions. suddenly, can no longer pass information way (it had been working until recent edits, , can't figure out change screwed up). have used log outputs determine data storing - setvariable(input) functions - when called later getvariable() functions returns null. thoughts? *note, started incorporating fragments project, extending fragmentactivity instead of activity on main class. don't think causing problem, it? if does, whats best practice pass global variable info, , use fragments? code samples: main inherited class: public class menubaractivity extends fragmentactivity { private string keya; private string keyb; private int token; private string salt; private long expires; public string getkeyb() { return keyb; } public st...

string - Subsequences whose sum of digits is divisible by 6 -

say have string characters nothing digits in [0 - 9] range. e.g: "2486". want find out subsequences sum of digits divisible 6. e.g: in "2486", subsequences - "6", "246" ( 2+ 4 + 6 = 12 divisible 6 ), "486" (4 + 8 + 6 = 18 divisible 6 ) etc. know generating 2^n combinations can this. that's costly. efficient way this? edit: i found following solution somewhere in quora. int len,ar[maxlen],dp[maxlen][maxn]; int fun(int idx,int m) { if(idx==len) return (m==0); if(dp[idx][m]!=-1) return dp[idx][m]; int ans=fun(idx+1,m); ans+=fun(idx+1,(m*10+ar[idx])%n); return dp[idx][m]=ans; } int main() { // input len , n , array memset(dp,-1,sizeof(dp)); printf("%d\n",fun(0,0)); return 0; } can please explain logic behind code - 'm*10+ar[idx])%n' ? why m multiplied 10 here? say have sequence of 16 digits generate 2 16 subsequences ...

pixel - Calculating average intensity of area with matlab regionprops -

i have grayscaled picture, there objects different shapes. have binary image of grayscaled picture. with majoraxeslength , minoraxislength ratio (from regionprops) can identify each of them, how can calculate average intensity each of objects? and possible calculate average intensity of lines, gives minoraxislength , majoraxislength? add regionprops 'pixelidxlist' handle. can following: s = regionprops(bw,'pixelidxlist'); n=1:numel(s) meani(n)=mean(image(s(n).pixelidxlist)); end this assumes bw binary image , image grayscale one.

linux kernel - Deleting a sysfs entry -

i trying learn sysfs , trying write simple sysfs directory. code below static struct kobject *example_kobject; static int __init mymodule_init (void) { pr_debug("module initialized \n"); example_kobject = kobject_create_and_add("kobject_example", kernel_kobj); if(!example_kobject) return -enomem; return 0; } static void __exit mymodule_exit (void) { pr_debug ("module un initialized \n"); // kobject_put(example_kobject); <-- forgot delete } module_init(mymodule_init); module_exit(mymodule_exit); as shown in mymodule_exit, had mistake forgot uncomment code , inserted , rmmod module. now when try insert module again, initialization failing entry present. i know, not make sense allow userspace remove entry kernel made. but, still wondering if there other way remove particular /sys/kernel/kobject_example entry other rebooting box. firstly, merely ...

excel - Pasting merged cells using VBA -

i'm trying copy row of data excel sheet , transfer sheet, range of row data has 2 column merged cell in , i'm having trouble pasting without errors. any tips helpful, for copy merged cells, need mention range. example : a9 , b9 merged, need use range("a9:b9").copy copy merged cell

Dealing with Meteor.Error and .wrapAsync() - best methods? -

please critique following methods of dealing errors in meteor: a common problem meteor.wrapasync() method on meteor doesn't seem return actual error external api: https://github.com/meteor/meteor/issues/2774 1. example using wrapasync() i'm using simple api takes zipcode , returns location information: /server/methods.js var getlocationasync = function(zipcode, callback){ http.call("get", "http://api.zippopotam.us/us/" + zipcode, function(error, result) { callback(error,result); }); }; var getlocationwithwrap = meteor.wrapasync(getlocationasync); meteor.methods({ getlocationwithwrap: function(zipcode){ return getlocationwithwrap(zipcode); } }); if meteor.call("getlocationwithwrap", "94043", function(error, result){ if(error){ console.log("here error: ", error) } else { console.log("success: ", result); } }) you proper response. if pass in in...

html5 - Cannot apply CSS filter property in IE10 -

i need apply css filter on body tag. use css rules - js fiddle css styles in chrome, ff, opera works fine. in ie 10 doesn't applying. what doing wrong? ie doesn't support filter properties. wait release of microsoft edge, support filter

xcode - How to connect a button to a new view controller iOS Swift? -

i'm pretty new swift , trying connect button view controller. on other apps have made swift have been able control-drag button view controller, display "show" option click. when run , click button show desired view controller. on app working on, trying add settings page accessed clicking button. when tried control-click , drag button second view control, displayed 3 options: push, modal, , custom. selected push, , when ran app , pressed button showed sinabrt error. how can connect button second view controller pressing it? you see "show" option if working on project targeting ios 8 , later, since new feature determine proper way show new view controller. opt "push" if in navigation controller , "modal" if in regular controller context. here might working project deploy target ios 7 or below. can choose use "modal" here present view controller bottom of screen , implement exit button. or can embed current view contro...

Modern practice for client side javascript source structure with CommonJS TypeScript etc -

my javascript foo okay haven't kept latest , greatest (we don't use node.js in backend). what modern practice of structuring client side javascript? we organize javascript in sub directories smaller files, , minify , concatenate them production. when check these popular client side js libraries https://github.com/mbostock/d3 https://github.com/jquery/jquery https://github.com/chriszarate/supergenpass they not written in client side javascript @ , seems alien me. it seems nowadays have learn commonjs , slew of frameworks comprehend , contribute. i tried googling around returns list of server side node.js related hits (grunt) none talks using maintain client side library. any pointers? so i've been doing more research. seems answer in commonjs , node.js some client side frameworks use commonjs break code modules (which browsers won't understand), , use node.js , package manager bowsify combine these modules single javascript file.

How to determine SurveyMonkey Date format? -

the surveymonkey api page has no details on how respondent's datetime date_only answer formatted. experimentally found has been in format ( mm/dd/yyyy , e.g. 09/24/2014 ). is, until today, when got several survey answers this: "respondent_id": "redacted", "questions": [ { "answers": [ { "text": "25/09/2014", "row": "7583496481" } ], "question_id": "redacted" }, ... my date parsing failed because 25 not valid month. seems dd/mm/yyyy format. there mixed formats same question_id . does have idea how predict format of date answers? the survey's language_id 1 . the type info question is: "type": { "subtype": "date_only", "name": "", "family": "datetime" } the format in dates collecte...

php - How can i enforce an extending class to have a static method? -

i want class b implement method that's been defined in class a. when following error. strict standards : static function a::test() should not abstract in c:\xampp\htdocs\test1.php on line 4 here php code: <?php error_reporting( e_strict ); abstract class a{ public abstract static function test(); } class b extends { public static function test(){ echo 'testing'; }; } echo b::test(); static methods not part of object, shouldn't extended. make method concrete. i struggled same problem once started building unit tests (i religiously avoid static methods now, that's whole side conversation). check out question answering question berr can: why php 5.2+ disallow abstract static class methods?

requeue the message in rabbitmq using Spring ampq -

i new rabbitmq , trying following scenario --> producer sends message --> consumer receives message -- execute own logic if logic fails - requeue --> requeue message if consumer fails(machine goes down) i have implemented basic sender using spring rabbittemplate rabbittemplate.convertandsend(.....); and consumer implemented message listener public class custommessagelistener implements messagelistener { @override public void onmessage(message message) { //** own logic** } } and added container through spring <bean id="alistener" class="com.sample.custommessagelistener" autowire="byname"/> <rabbit:listener-container id="mylistenercontainer" connection-factory="connectionfactory" acknowledge="auto" prefetch="750" concurrency="5" > <rabbit:listener ref="alistener" queues="reportqueue"/> </rabbit:listener-...

julia lang - inside type definition is reserved -

the code worked in 0.3: type foo bar::int = 0 end after migrating julia 0.4- produces errors like julia4 test.jl error: loaderror: syntax: "bar::int=0" inside type definition reserved in include @ ./boot.jl:254 in include_from_node1 @ loading.jl:133 in process_options @ ./client.jl:306 in _start @ ./client.jl:406 what error mean? how fix in 0.4-? nb i understand dev version. did googled , consulted manual http://julia.readthedocs.org/en/latest/manual/types/ i don't think called "default field values" ever worked expected, in future (0.6 ish) might. see https://github.com/julialang/julia/issues/10146

php - GraphViz Install Fail -

i trying install graphviz on ubuntu server getting following error.. sudo pear install image_graphviz downloading image_graphviz-1.3.0.tgz ... starting download image_graphviz-1.3.0.tgz (16,706 bytes) ......done: 16,706 bytes could not extract package.xml file "/build/buildd/php5-5.5.9+dfsg/pear-build-download/image_graphviz-1.3.0.tgz" download of "pear/image_graphviz" succeeded, not valid package archive error: cannot download "pear/image_graphviz" download failed install failed any advice? info below in case matters... pear version: 1.9.4 php version: 5.5.9-1ubuntu4.9 zend engine version: 2.5.0 running on: linux xserver 3.16.0-34-generic #47~14.04.1-ubuntu smp fri apr 10 17:49:51 utc 2015 i686 this issue described @ http://cweiske.de/tagebuch/pear-php-5.5.htm try fix following: $ pear upgrade -z archive_tar $ pear install image_graphviz if not work, follow instructions in blog pos...

how to update all rows of a specified data group in SQL server based on a condition? -

Image
i have data: i need update "isconsiderednewhire" column if there 0 in control group related it, other rows control group should zero. after update, you'd this: i'm having hard time figuring out how accomplished. anyone want give me hand? you can this: update mytable set isconsiderednewhire = 0 controlgroupid in (select distinct controlgroupid mytable isconsiderednewhire=0)

javascript - Access to nested object json in SoundCloud with ember-data -

Image
i working on soundcloud json favorites songs user. you can see here i can access favorites tracks can not access user id , username. here code using returns favorite properties , have commented code not working return user properties. i error in console "uncaught typeerror: item.user.foreach not function" what doing wrong? right way access user properties? model: function(params) { var artist, favoritelistproxy, self; self = this; artist = params.artist; this.controllerfor('application').set('artistname', artist); favoritelistproxy = ember.arrayproxy.create({ content: [] }); return new ember.rsvp.promise(function(resolve, reject) { return sc.get("/users/" + 'mannaio' + "/favorites", {limit: 40}, function(favorites) { if (favorites.length) { favorites.foreach(function(item, index, arr){ var favorite; favo...

c++ - Starting threads within Python extensions -

i'm trying start thread within swig python c++ extension, however, when go run it produces following: libc++abi.dylib: terminating abort trap: 6 i'm guessing there shouldn't issue gil since no python-allocated objects being used. or wrong in assumption? a minimal example: // _myextension.cpp #include <iostream> #include <thread> void threadfunc() { std::cout << "thread started" << std::endl; std::this_thread::sleep_for (std::chrono::seconds(10)); std::cout << "thread ended" << std::endl; } void start() { std::thread first (threadfunc); } // _myextension.i %module _myextension %{ extern void start(); %} extern void start(); // test.py import _pymapper _pymapper.start() simple fix, thread has detached after being created, so: void start() { std::thread first (threadfunc); first.detach(); } then, works fine! however, thread killed prematurely once statements have been c...

amazon web services - Can we add instances manually in EB data tier -

i have started using elastic beanstalk tomcat8-java8 application. elastic beanstalk setup nice application rds data tier. possible add instance, created manually, in data tier redis caching server. feedbacks. there's nothing elastic beanstalk says cannot communicate other servers. an application running under elastic beanstalk can access other resources such s3 buckets, databases, , other servers, etc. long various permission levels allow (vpc, security groups, etc.) so can add redis server manually elastic beanstalk application can utilize. need ensure application can "get to" redis server.

Git: How to change origin on locally cloned branch -

i have front-end sass framework building on local drive. started project cloning different project on local drive. now need framework independent copy other master. the .git/config framework: [remote "origin"] url = s:/grunt-test fetch = +refs/heads/ruby-sass-susy:refs/remotes/origin/ruby-sass-susy [branch "master"] remote = origin merge = refs/heads/ruby-sass-susy how safely modify framework disconnects original repo? run following 2 commands , set [new_src] location of new repository: git remote rm origin git remote add origin [new_src] this change .git/config file , remove reference old repository. of course, don't need set new origin . if have tracking branches origin, might want untrack with: git branch -d -r origin/<remote branch name>

Using Cygwin on windows 8 - missing cygpng15-15.dll -

unfortunately, have no idea i'm doing when comes using cygwin. need run program known xfig. have installed cygwin using instructions provided here . believe have done steps correctly. however, when try , start xfig using command $ xfig &, given error $ /usr/bin/xfig.exe: error while loading shared libraries: cygpng15-15.dll: cannot open shared object file: no such file or directory i'm not sure this. missing sort of library need use cygwin? running on windows 8. appreciated. you can start command: cygcheck --package-query cygpng15-15.dll which return lot of crap: found 5 matches cygpng15-15.dll cygwin32-libpng-1.5.12-1 - cygwin32-libpng: png library cygwin 32bit toolchain (installed binaries , support files) libpng15-debuginfo-1.5.21-2 - libpng15-debuginfo: debug info libpng15 (installed binaries , support files) libpng15-debuginfo-1.5.22-1 - libpng15-debuginfo: debug info libpng15 (installed binaries , support files) libpng15-1.5.21-2 - libpng15: ...