Posts

Showing posts from April, 2013

How to get magnitude of signals in Verilog -

i have module magnitude : module magnitude( input [31:0] re, input [31:0] im, output [31:0] out ); assign out = re * re + im * im; endmodule now, 128 signals, need find out magnitude. is, need way count 128. how can that? also, first verilog code wrote. advice on making efficient welcome. according understanding of question, may intend following: module magnitude( input [31:0] re, input clk; input reset; input [31:0] im, output reg [31:0] out ); reg [6:0] counter; @(posedge clk or negedge reset) begin if(!reset) begin counter<=0; end else begin if (counter==7'd128) counter<=0; else counter<=counter+1; end end @(posedge clk or negedge reset) begin if(!reset) out<=0; else begin if (counter==7'd127) out<=0; // counter counts 128, become zero. else out <= out + re * re + im * im; end end endmodule

How to reduce consumption on arduino system? -

this simple example. how reduce total power consumption without modify hardware, , modify program??? of course delay(1000) shouldn't changed. thank everyone. ps. because after see video http://v.youku.com/v_show/id_xmtmxndc0ndaxng==.html?f=26075379&from=y1.7-3&utm_campaign=newsletter-cn-sep2015-taiwan%28v1%29&utm_medium=email&utm_source=eloqua , and want applicate on project. still don't know how use ""picopower""to reduce arduino system. // pin 13 has led connected on arduino boards. // give name: int led = 13; void setup() { pinmode(led, output); } void loop() { digitalwrite(led, high); delay(1000); digitalwrite(led, low); delay(1000); }

linux - How do I boot from an .hddimg file? -

after running bitbake on several different recipe files, bitbake generates file of type '.hddimg'. haven't been able find clear explanation on file used for, closest have found speculation on mailing list here . author paul states that: the image isn't image of regular bootable system drive, "live image" of smaller system can either boot real system virtualized file system in ram image read single file in first level, or can install real system different drive. the 'bootimg.bbclass' generates .hddimg, , in opening comments written that: a .hddimg file [is] msdos filesystem containing syslinux, kernel, initrd , rootfs image. these can written harddisks directly , booted on usb flash disks (write them there dd). which appears corroborate paul wrote, still leaves lot of ambiguity on how go booting file (at least greenhorn me). well, doc says "write them there dd". so: dd if=/path/to/your/hddimg of=/path/to/

windows - Batch file ignores ELSE statement inside a FOR loop -

i creating batch file decompresses archives detect in specified folder. right trying detect archive files within specified folder using code: @echo off setlocal setlocal enabledelayedexpansion set quote=" set cwdtext=current working directory: set cwd=%cd% set fullcwd=%cwdtext%%cwd% set path=%~dp0 set types=file_types.txt set fullpath=%path%%types% echo %fullcwd% echo %fullpath% :specifypath echo: set /p directory=specify full path location of archive files: if "%cd%"=="%directory%" ( echo specified location current directory goto specifypath ) else ( pushd %directory% cd goto checkarchives ) :checkarchives %%t in (*.zip,*.rar,*.7z) ( if exist %%t ( echo archive files detected goto eof ) else ( echo archive files not detected goto eof ) goto eof ) :extract echo extracting archive files :eof pause the part wherein start checking archive files @ :checkarchives label. problem i'm having right whenever try specify folder wherei

r - Print colnames with spaces -

df = readrds('mydata.rds') message('column names: ',colnames(df)) output column names: col1col2col2col4 how can print spaces like column names: col1 col2 col3 col4 you can use paste() . used mtcars data set , added line-break. message( "now have following columns: ", paste(colnames(mtcars), collapse = " "), "\nand following rows: ", nrow(mtcars) ) # have following columns: mpg cyl disp hp drat wt qsec vs gear carb # , following rows: 32

java - MS Sql server Hostname connectivity issue -

we facing connectivity issue mssql server using java application. hostname mssql server below “chennai.sqlsrv.codings.group.vps.local\cpss3" is there limitation host name character ?..or such below reasons string long ? string malformed (\cpss3) ? in other words if open connection using sqlserver management studio , use same parameters we’re able see , browse db’s objects. if use hostname "cpp123" java application works fine without connectivity issue. any appreciated..

json - How to get values of JSONP returned array -

i'm getting data on local cross domain. $.ajax({ type: "get", url: "http://sunnah.com/ajax/urdu/bukhari/1?callback=items", datatype: 'jsonp', jsonpcallback: 'items', jsonp: 'callback', success: function (data) { var data = $.parsejson(data) console.log(data); } }); i can see returned json array [{"urduurn":"4000010","collection":"bukhari"}....] can seen given url . unable in console.log(data) wish put it's values html element returning data doing loop. please apprise me i'm doing mistake? try this: $.ajax({ type: "get", url: "http://sunnah.com/ajax/urdu/bukhari/1?callback=items", datatype: 'jsonp', jsonpcallback: 'items', jsonp: 'callback', success: function (data) { var strdata = json.stringify(data); console.log(strdata ); } });

html5 - how to provide notification with PHP -

Image
please explanation of how provide notification when enter data form stored in database? the picture above example notivikasi when form empty, ask how make successful notivikasi when form filled in data? if (isset($_post['btnsimpan'])) { $nama_kat = $_post['nama_kat']; $pesanerror = array(); if (trim($nama_kat)=="") { $pesanerror[] = "<b>kategori</b> masih kosong cuy,...!!"; } $ceksql="select * kategori nama_kat='$nama_kat'"; $cekqry=mysql_query($ceksql) or die ("eror query".mysql_error()); if(mysql_num_rows($cekqry)>=1){ $pesanerror[] = "sorry bos kategori <b> $nama_kat </b> sudah ada, ganti dengan yang lain ya,..!!"; } if ($pesanerror){ echo "<div class='msgerror'>"; foreach ($pesanerror $indeks=>$pesan_tampil) { echo "

html - How to make image position absolute relative to another image? -

#main { border: 2px blue solid; width: 100%; } #photo { display:flex; align-items: center; justify-content: center; } #photo > #large { width:70%; margin: 20px 0px; border: 3px red solid; } #small { position: absolute; width:150px; left:0px; } <div id="main"> <div id="photo"> <img src="image/test.jpg" id="large"> <img src="image/sale.jpg" id="small"> </div> </div> above code, want large image centre in photo div , small image set absolute , relative large image. how can that? now small image relative main div. you need use div here. #main { border: 2px blue solid; width: 100%; } #photo { display:flex; align-items: center; justify-content: center; } #photo > #photo-center { width:70%; position:relative; margin: 20px 0px;

replace - Replacing multiple text strings in blocks of text using jquery.each() -

i'm trying create nested loops apply clickable definitions words within several blocks of texts. first, outer loop iterates through definition names , ids in each class 'n-concept' , creates new <span> used inner loop. inner loop goes through each block of 'original-text' , replaces each instance of 'nounname' <span> template created in first loop. here's code... $(document).ready(function(){ $('.n-concept').each(function(){ var nounname = $(this).find('h3').html(); var nounid = $(this).attr('id'); var newstring = '<span data-vocabid="'+nounid+'" class="noun-name">'+nounname+'</span>'; $('.original-text').each(function(){ var newtext = $(this).text().replace(regexp(nounname, 'gi'), newstring); $(this).html(newtext); }); }); }); currentl

c# - ASP MVC DateTime Validation Issue in IE9 -

i working on fixing bug on application developed asp.net mvc razor , angular. the problem in ie9 datetime value not displayed @ in input box. i have tracked down "required" keeps adding required="required" . the incidentdate property in model nullable datetime. public system.datetime ? incidentdate { get; set; } it works fine in ie10+,ff , chrome in ie 9 datetime not displaying @ all. if edit markup html , remove required tag datetime value appears in input box. i tried adding following line in application_start still same issue: modelvalidatorproviders.providers.clear(); modelvalidatorproviders.providers.add(new dataannotationsmodelvalidatorprovider()); here markup generated in ie <input name="incident.incidentdate" class="form-control ng-valid ng-isolate-scope input-validation-error ng-touched ng-dirty ng-valid-parse" id="incident_incidentdate" aria-invalid="true" aria-required="true" a

javascript - EmberJS and third-party libraries -

i'm trying implement digest auth in ember app. complete took library - https://github.com/inorganik/digest-auth-request . have no idea how use in app. auth service looks next: import ember 'ember'; export default ember.service.extend({ path: "some-path", username: "", password: "", me(successhandler) { var merequest = new digestauthrequest('get', this.path + "/me", this.username, this.password); merequest.request(successhandler); }, setcredentials(username, password) { this.username = username; this.password = password; console.log(this.username); } }); and got following errors: services/auth.js: line 9, col 29, constructor name should start uppercase letter. services/auth.js: line 9, col 29, 'digestauthrequest' not defined. my attempt adding digestauthrequest.js vendor folder, , adding app.import('vendor/digestauthrequest.js')

How do I escape special characters in MySQL? -

for example: select * tablename fields "%string "hi" %"; error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'hi" "' @ line 1 how build query? the information provided in answer can lead insecure programming practices. the information provided here depends highly on mysql configuration, including (but not limited to) program version, database client , character-encoding used. see http://dev.mysql.com/doc/refman/5.0/en/string-literals.html mysql recognizes following escape sequences. \0 ascii nul (0x00) character. \' single quote (“'”) character. \" double quote (“"”) character. \b backspace character. \n newline (linefeed) character. \r carriage return character. \t tab character. \z ascii 26 (control-z). see note following table. \\ backslash (“\”) character. \% “%” character. see note following ta

maven - Dependency management with spark -

i'm running spark jobs through airflow. rather hardcoding path, or having directory bucket of jars, i'd use dependency manager tell me jars in local repo (and better, maybe them remote repo if not available). is there tool exists can either 1 or both of these things? i'd happy sbt plugin, apache ivy, or else completely. even better if it's sbt can publish to.

sorting - How to iterate through memory block (created with malloc) in C? -

my objective read unknown amount of integers text file, store them block of memory, sort them, , output new file. have program can read integers file , output them, , i'm trying implement sorting part. i'm coming class arts background, , professor's instructions on how use unclear me. instructions: use malloc() assign memory block integer pointer. each time new integer read input file , current memory block not enough hold it, use realloc() assign more space memory block hold more integers. may use *(ptr+x) (an equivalent way use ptr[x]) access (x+1)th integer in memory block pointed integer pointer ptr. may apply sorting algorithm (e.g., selection sort or bubble sort) you've learned in previous courses sort these integers. what i'm not understanding how iterate through allocated memory block in order sort it. x professor mentions? if clarify how use this? don't want post code avoid cheating. thanks! int x; // uninitialized variable (its cont

marklogic - XML file upload using MLCP -

we trying upload xml files(some of them of 2gb) not getting uploaded in database using mlcp. i created new database , forest , new port . made changes mlcp.bat below set optfile="load_mlcp.txt" call d:\mlcp-1.3-3-bin\mlcp-1.3-3\bin\mlcp.bat -options_file %optfile% echo "data load complete" pause the load_mlcp.txt file has below code import -mode local -host localhost -port 8047 -username admin -password ###### -input_file_path d:\\mlcp_data\\ -output_uri_replace "mlcp_data" ran mlcp.bat file in command prompt not see xml files(not small files) being uploaded in database . we getting error : "batch recursion exceeds stack limits" , "batch processing aborted". please , suggest . the error message in step 5 indicates have batch file calling recursively. sounds accidentally edited d:\mlcp-1.3-3-bin\mlcp-1.3-3\bin\mlcp.bat make call recursively. you better choose different batch file name initiate mlcp corre

php - jQuery .post how to add Failure -

i have below script , works want add alert when went wrong. part of drupal module. my short php: ajax_function() { //below failure part. want display message drupal_json(array('status' => 'failure', 'message' => 'you cannot submit this.')); } the js: button.click(function(e) { e.preventdefault(); var path = 'to/ajax/function'; $.post(path, function(data) { //submits on success $('#webform').submit(); }); }); you can use: .done succes, .fail error , .always finished var yourpost = $.post(path, function(data) { //submits on success $('#webform').submit(); }) .done(function() { alert( "second success" ); }) .fail(function() { alert( "error" ); }) .always(function() { alert( "finished" ); }); please see: http://api.jquery.com/jquery.post/ update you can value of array. this. button.click(function(e) {

osx - `view.window` is nil inside `NSViewController-viewDidLoad` -

i' trying access view.window inside nsviewcontroller-viewdidload it's nil. there way force window load inside viewdidload ? i'm pretty sure answer direct question "no"; can't make window load inside -viewdidload , in middle of nib-loading process @ point , is. depending on how nib constructed, , internal details of appkit, might find window loaded , connected in -viewdidload , not should rely upon, since not guaranteed. want using -awakefromnib instead; called after objects in nib have been loaded , initialized, window should set @ point.

Rollback is not working with WMQ while throwing Exception with Spring and JBOSS eap-6.1 -

i using jboss eap-6.1 ,wmq spring.when rolling messages , not going backout , not staying inqueue.but working activemq.below configuration files,please me if doing wrong. jboss/standalone.xml configuration <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> <resource-adapters> <resource-adapter id="wmq.jmsra.rar"> <archive> wmq.jmsra.rar </archive> <transaction-support>xatransaction</transaction-support> <connection-definitions> <connection-definition class-name="com.ibm.mq.connector.outbound.managedconnectionfactoryimpl" jndi-name="java:jboss/mq.connectionfactory.name" pool-name="mq.connectionfactory.name"> <config-property name="port"&

ruby on rails - Heroku throws error on db:migrate rake -

when i'm trying throw heroku run rake db:migrate said in ror tutorial michael hartl throws me following: running rake db:migrate on shielded-reaches-4728... up, run.2183 rake aborted! nomethoderror: undefined method 'configure' #<sampleapp::application:0x007efe8ced6138> /app/config/environments/production.rb:1:in '<top (required)>' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in 'require' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in 'block in require' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in 'load_dependency' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in 'require' .. tasks: top => db:migrate => environment (see full trace running task --trace) what can do? update: production.rb file: rails.applicati

locking - Can someone give a simple example of using a non-scalable lock? -

i bit confused non-scalable locks .can give me example , explain how works? you use non-scalable lock in same way scalable-lock. difference is, non-scalable version might in trouble high contention. on other hand non-scalable locks might bit more responsive if used lightly (which common scenario). see also: what scalable lock? if want sample need specify programming language , lock primitive want (not) use.

iphone - Share data on Weibo and QQ internation in iOS -

i trying share data on qq internation , weibo, not getting such way post data on messengers, tried lot sharing data on weibo , qq internation not getting result. guide me correct way , way share data on both messegner. you might want @ sdk's offer. third-party service providers encapsulate services on platforms such iphone in special sdk (software development kit) can talk servers. qq ios sdk weibo ios sdk

php - curl_exec return false while try to connect to URL -

i trying create push notification application send messages server users device. for registration ids when run curl_exec function following error: curl failed: couldn't connect host i don't know why , made checks , when try change url "google.com" pass. browser if try reach original url redirect me : " https://developers.google.com/cloud-messaging/ " php code: <?php class gcm { function __construct() { } /** * sending push notification */ public function send_notification($registatoin_ids, $message) { // include config include_once 'connection.php'; // set post variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' => $registatoin_ids, 'data' => $message, ); $headers = array( 'authorization: key=' .google_api_key, 'co

css - Chrome SVG fill not working -

i'm having problem getting fill value in css work in chrome svg icon. firefox , other browsers render fill fine in chrome should fill straight black. this css .color-primary .session { background: #4e60ab; fill: #a4add8; } it seems pretty straightforward , again, renders ok in firefox. 1 else experience this?

javascript - How to add condition to EmberJS Input Helper -

how can build input <input class="{{unless isediting "hidden"}}" /> input helper of ember.js? you can use parenthesis have helper within helper {{input class=(unless isediting "hidden")}}

android - FilterQueryProvider not working -

i using following snippet: filterqueryprovider provider = new filterqueryprovider() { @override public cursor runquery(charsequence constraint) { /* uri uri = textutils.isempty(constraint) ? employeecontentprovider.uri_employees : uri.withappendedpath(employeecontentprovider.uri_employees, constraint.tostring()); */ return getcontentresolver().query( employeecontentprovider.uri_employees, employee.fields, employee.col_name + " ?", new string[]{constraint.tostring()}, null); } }; in above if use uri.withappendedpath , supply _id field search constriant, works fine. want search based on name. here not working. content provider follows: @override public cursor query(uri uri, string[] projection, string selection, string[] selectionargs, string sortorder) { cursor result = null; system.out.print

java - Load jboss-ejb-client.properties from local file system and set IntialContext for jndi lookup -

unable set jboss-ejb-client.properties in environment of spring application, loaded local file system jboss-ejb-client.properties: remote.connectionprovider.create.options.org.xnio.options.ssl_enabled=false remote.connections=default remote.connection.default.host=10.203.67.52 remote.connection.default.port=8080 remote.connection.default.connect.options.org.xnio.options.sasl_policy_noanonymous=false remote.connection.default.username=**** remote.connection.default.password=**** below file jboss-ejb-client.properties loaded, file not overriding spring jar (jboss-ejb-client.properties) file wanted dynamically pass server "hostaddress" application via local filesystem property file @configuration @propertysources({ @propertysource(value = "file:${art_config_dir}/jboss-ejb-client.properties", ignoreresourcenotfound = true) public class synchronizerjobconfiguration {...... is there way load , set jboss-ejb-client.properties file spring run time envi

web services - Confluence space and Page Analytics -

i'm working on confluence bpm. new confluence developer , user well. my questions are: how see total space visit in day, week, month , year? (exact count not chart) how statistics of top 5 pages visited in day, week, month , year? how statistics of users use space or wiki frequently? note : this statistics should ignore counts of user "abc".

Error during execution Stored Process SAS -

Image
i made stored process sas stores process wizard. need create date range. did , when set date range after execution error: it looks you're trying compare dates in clause, in case you'll have convert text date numeric, e.g. try using: where "&date_range_min"d < date_entered < "&date_range_max"d regards, amir.

Thumbnail bitmap image doesn't show up in fragment class -

the dilemma want use mediastore.images.thumbnails.getthumbnail thumbnail sdcard , show in fragment class (which requested in mainactivity). here code. there no error in code imageview shows nothing @ all. public class fragmentclass extends fragment { string tag = "hi"; imageview image; long imageid; public fragmentclass() {} @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.fragment_fragment_class, container, false); image = (imageview) v.findviewbyid(r.id.imageview); string projection[] = { mediastore.images.thumbnails._id, mediastore.images.thumbnails.data}; contentresolver contentresolver = getactivity (). getcontentresolver(); cursor cursor = mediastore.images.thumbnails.query(contentresolver, mediastore.images.thumbnails.external_con

c++ - Why is there no std::is_transparent equivalent for unordered containers? -

c++14 introduces compare::is_transparent equivalent find operations in associative containers. template< class k > iterator find( const k& x ); template< class k > const_iterator find( const k& x ) const; finds element key compares equivalent value x. overload participates in overload resolution if qualified-id compare::is_transparent valid , denotes type. allows calling function without constructing instance of key since there no longer temporary instance of key constructed, these can more efficient. there not seem equivalent unordered containers . why there no compare::key_equal / compare::hash_equal ? i imagine relatively simple allow efficiently looking of, eg, string literals in unordered containers? template<> struct hash<string> { std::size_t operator()(const string& s) const { return ...; } // hash_equal=true allows hashing string literals std::size_t operator()(const char* s)

java - Web application using JSP web application or applet? -

if want make web application in java mean jsp should create applet , put browser or create "java web project"? in other words big companies system oracal , others have there own system creating java web application or using applet , putting browsers. thanks i create "java web project". using applet considered bad practice due of security issues , need user install correct version of java , , enable in browser . go solid java web framework spring / spring-mvc . see guide on how start: https://spring.io/guides/gs/serving-web-content/

batch file not running completely -

i have below batch file cd c:\batchtest\a\a-app mvn dependency:tree > a.txt cd c:\batchtest\b\b-app mvn dependency:tree > b.txt while running giving below output c:\batchtest>abcd c:\batchtest>cd c:\batchtest\a\a-app c:\batchtest\a\a-app>mvn dependency:tree 1>a.txt c:\batchtest\a\a-app> it not running last 2 commands. missing here? thanks help. mvn bat file - so you need invoke call mvn.. : @echo off cd c:\batchtest\a\a-app call mvn dependency:tree > a.txt cd c:\batchtest\b\b-app call mvn dependency:tree > b.txt

memory - PHP CLI ram management -

i made php script runs in background, script takes around 10mb on ram, & i've multiple scripts running @ time, im afraid out of ram. i've optimized code set variables , objects null. is there way manage ? thank you. even though has become better, php not suitable long-running processes in opinion, calling gc_collect_cycles(); on regular basis can wonders, if have deal lot of data (import scripts , on). without code can not offer more help.

php - Javascript won't href to another page -

this might sound stupid question, that's because is. there reason won't href page? click , literally nothing happens. window.location.href = "http://theromdepot.com/roms/report.php?file=" + window.location.pathname + "/" + document.getelementbyid('title').innerhtml + "&issue=" + issue; i made website functions same way , works fine. code else, it's sending information same way: window.location.href = "rename.php?originalname=" + originalname + "&newname=" + newname; there's strange going on because copied , pasted code other website work , had same issue. click button , nothing happens. put alert before , after href make sure function being called , is, no page change. not sure if php involved in way. can tell me what's going on here? here's full page: http://pastebin.com/zhfhcymv here's website in case: http://theromdepot.com/ in page, line of code: window.location.

Why am I getting a javascript NaN error message? -

doing project intro javascript class , can't quite figure out why isn't working. can me out? here code assignment. //declare variables var guestsperroom; var discount; var goodview; var totalcost; var costpernight; var membership; //prompt user enter info based on needs guestsperroom = prompt("how many guests staying in room? (max 6)"); discount = prompt("are member of aaa?"); goodview = prompt("would room view? (10% price increase)"); //calculate guests needs total cost totalcost = number(totalcost); discount = number(discount); costpernight = number(costpernight); //output users total cost if (guestsperroom === 1 || guestsperroom === 2) { costpernight = 50; if (membership === 'y') { discount = costpernight * 0.85; } else if (membership === 'n') { discount = costpernight; } if (goodview === 'y') { totalcost = costpernight * discount * 1.1;‹ } else if (goodview === 'n') { tota

asp.net core - Targeting different providers per logger -

is not possible target different logging providers based on logger used? for example, refer below code: // establish loggers var somelogger = loggerfactory.createlogger("somelogger"); var anotherlogger = loggerfactory.createlogger("anotherlogger"); // hook providers (but not @ individual logger's level??) loggerfactory.adddebug(minimumlevel: loglevel.debug); loggerfactory.addconsole(minimumlevel: loglevel.debug); loggerfactory.addblob(connectionstring, minimumlevel: loglevel.information); // log stuff somelogger.logerror("logging somelogger"); anotherlogger.logerror("logging anotherlogger"); all providers logged here, regardless of logger used. is not possible? point of defining separate loggers if log every provider regardless? i'm not sure if that's possible can log messages of different log levels different providers. example below logs warning level messages , above event log using sourceswitch api. use ca

javascript - Ionic Framework - $ionicLoading: How to display both spinner and label? -

i don't see option display both spinner , label message! docs . is there simple way or must have myself? example (it doesn't have of course): http://www.jqueryscript.net/images/jquery-ajax-loading-overlay-with-loading-text-spinner-plugin.jpg thanks! you can try this: $ionicloading.show({ template: '<ion-spinner></ion-spinner> <br/> label' }); not tested, think show spinner, maybe no animation.

javascript - Bootstrap + Masonry add blank divs when grid have empty spaces at the bottom -

i'm using masonry + bootstrap , notice when have 3-column grid have 10 items, display 3x4 grid having 2 blank spaces @ bottom. how automatically add 2 empty divs @ bottom fill , not having blank spaces? total div become 12 wherein 2 divs blank? this isn't supposed fixed 3-column should dynamically add empty divs whenever detected there n number of empty divs filled up. should applicable on load , on resize. there no problem .item size since have same width , height (box/square type) i made jsfiddle add fillers on empty spaces on last row. working on on resize using layoutcomplete event. problem is, whenever resize, keeps on appending new fillers. try re-sizing different sizes , you'll notice keeps on adding fillers. in case, here's code well. html <input type="hidden" name="hftotalgriditems" id="hftotalgriditems" value="10" /> <div class="grid"> <div class="item">

service - NotificationService in android M -

my application uses notificationservice works fine on devices android l. when trying on device android m, service doesn't start. oncreate not fired @ all. service declared in androidmanifest: <service android:name="com.abc.def.mycustomservice" android:permission="android.permission.bind_notification_listener_service"> <intent-filter> <action android:name="android.service.notification.notificationlistenerservice" /> </intent-filter> </service> any ideas how fix issue?

php - Unable to send more than 1000 variables through url -

i had search form , result stored in array , passed through url page wish displayed.now when below 1000 items searched works otherwise lead internal server error. there other methods url encryption can solve internal error? please me avoid internal server error code follows $cfinalarray = array_intersect($clarray1, $clarray2, $clarray3, $clarray4, $clarray5, $clarray6, $clarray7, $clarray8, $clarray9, $clarray10, $clarray12, $clarray13, $clarray14, $clarray15, $clarray16, $clarray17, $clarray18, $clarray19, $clarray20, $clarray22, $clarray23, $clarray24, $clarray25, $clarray26); if (count($cfinalarray) > 0) { $arrayc = array_values($cfinalarray); arsort($arrayc); $ab = http_build_query($arrayc); header("http/1.1 301 moved permanently"); header("location: http://example.com/a/b?$ab"); } else { header(&

java - Data type Double is displaying value 0.0 -

this question has answer here: division of integers in java 7 answers i have been programming javascript year , half now, , have began learning java syntax. when trying recreate simple program wrote in javascript, have ran trouble when using double data type. here code: scanner input = new scanner (system.in); int questionstotal; int questionscorrect; double grade; system.out.println("how many questions there in total?"); questionstotal = input.nextint(); system.out.println("how many questions did correct?"); questionscorrect = input.nextint(); grade = questionscorrect / questionstotal * 100; system.out.println("your grade is: " + grade); it isn't in snippet, java.util.scanner imported. when user enters values questionstotal , questionscorrect, process fine. however, grade variable not function planned. when printed, display

group by - pandas groupby aggregate with grand total in the bottom -

here code: import stringio pandas import * import numpy np df = read_csv(stringio.stringio('''col1 col2 b d 1 6 e 2 7 b d 3 8 b e 4 9 c d 5 19'''), delimiter='\t') df['buc1'] = cut(df['a'], bins = [0, 2, 6, 8]) aggfunc = {'a': sum, 'b': np.average } after running: df.groupby(['buc1']).agg(aggfunc) i get: b buc1 (0, 2] 3 6.5 (2, 6] 12 12.0 (6, 8] nan nan my questions are: how rid of bottom (6, 8] bucket, given there no values there? how add grand total row @ bottom, in pivot table in excel? for instance: buc1 b (0, 2] 3 6.5 (2, 6] 12 12 total 15 9.8 note total row second column average, not sum. to drop na records, can use .dropna() dataframe method. df['buc1'] = df['buc1'].astype(object) result = df.groupby(['buc1']).agg(aggfunc).dropna() result

javascript - meteor display first element of array in template spacebars -

i want display in template first element of array. i've seen many topics including this one doesn't work in case. i have helper this: template.home.helpers({ posts() { return posts.find({}); } }); i in template: {{posts.[0].title}} i don't want use findone in case. best @ helper level, example, add optional index argument posts helper: template.home.helpers({ posts(index) { if(typeof index !== "undefined" && index !== null){ var data = posts.find(); return data[index]; } else{ return posts.find(); } } }); then set data context , call in blaze this: {{#with posts 0}} {{title}} {{/with}}

c - lua inside function appears segfault -

code: m_l = lual_newstate(); if(m_l==null) { return -1; } lual_openlibs(m_l); i use gdb test code, when runs lual_openlibs(m_l); gdb tell me program received signal sigsegv, segmentation fault. luah_getstr (t=0x7fa950, key=0x7cc2e0) @ ltable.c:458 458 if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key)) don't knwo how fix it. please me out.

c# - Xamarin.Forms Reference conflict -

Image
my problem in xamarin.forms i tried use class reachability.cs xamarin (downloaded official source) used check url or ip address reachable. when try build shows me following error message: reference type 'ipaddress' claims defined in 'system', not found i dont know how solve usings using system; using systemconfiguration; using corefoundation; kind regards, stefan reachability.cs depends on system.net classes not exist in pcl. test reachability in forms, use connectivity plugin instead.

UITextView can't show svg with image tag -

i want show html uitextview,but svg image can't displayed, can me? below html: <?xml version="1.0" encoding="utf-8" standalone="no"?> <!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta content="true" name="calibre:cover"/><title>cover</title><style type="text/css"> @page {padding: 0pt; margin:0pt} body { text-align: center; padding:0pt; margin: 0pt; } </style></head><body><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="100%" preserveaspectratio="none" version="1.1" viewbox="0 0 600 800" width="100%"><image height="800" width="600" xlink:hr

java - Click Run in eclipse and nothing happens -

i have situation in eclipse, before work in eclipse app running fine, today, not working. click on progect->run as->android application. , nothing happens, no error, no popup window, nothing in console: 2015-10-15 11:01:03 - test] android launch! [2015-10-15 11:01:03 - test] adb running normally. [2015-10-15 11:01:03 - test] performing com.example.test.mainactivity activity launch [2015-10-15 11:01:03 - test] automatic target mode: launching new emulator compatible avd 'nexus_5_api_22_x86' [2015-10-15 11:01:03 - test] launching new emulator virtual device 'nexus_5_api_22_x86' [2015-10-15 11:01:04 - emulator] emulator: error: x86 emulation requires hardware acceleration! [2015-10-15 11:01:04 - emulator] please ensure intel haxm installed , usable. [2015-10-15 11:01:04 - emulator] cpu acceleration status: hax kernel module not installed! please tell me, how can run app in eclipse android phone? if set gpu emulation yes avd, graphics acceleration aut

c - HOWTO get the correct Frame Pointer of an arbitrary thread in iOS? -

Image
way frame pointer on demo app running on iphone 5s device / xcode 7, tried frame pointer of arbitrary thread using thread_get_state , result in incorrect 1 : - (bool)fillthreadstate:(thread_t)thread intomachinecontext:(_struct_mcontext *)machinecontext { mach_msg_type_number_t state_count = machine_thread_state_count; kern_return_t kr = thread_get_state(thread, machine_thread_state, (thread_state_t)&machinecontext->__ss, &state_count); if (kr != kern_success) { char *str = mach_error_string(kr); printf("%s\n", str); return no; } return yes; } i read frame pointer this: uintptr_t fp = machinecontext.__ss.__fp; , according apple doc ( armv6 , arm64 ), register r7 used frame pointer on armv6 while x29 on arm64 the frame pointer register (x29) must address valid frame record, although functions—such leaf functions or tail calls—may elect not create entry in list. result, stack traces meaningful,

HTML5 <input type="date"> change -

Image
is there way change input type="date",i want replace circle button else. the circle button gives date of today. the circle button mention native chrome, doesn't appear in firefox or ie11 (see can use reference). might want consider using jquery ui instead cross browser support.

php - How do I use eloquent for TIMEDIFF? -

public function fire() { log::info('delete abandoned builds.'); $builds = build::where('status', build::status_abandoned) ->whereraw (timediff(date_format(now(), '%y-%m-%d %h:%i:%s'), created_at) >= '01:00:00')->get(); $buildrepository->delete($build); $buildrepository = new buildrepository(); } basically, have delete builds after have been abandoned 1 hour. gives me error timediff undefined. can tell me how can fix this? you use eloquent , datetime instead of timediff $date = new datetime; $date->modify('-60 minutes'); $formatted_date = $date->format('y-m-d h:i:s'); db::table('builds') ->where('status', build::status_abandoned) ->where('created_at','>=',$formatted_date) ->delete();

Multiple dynamic data input to mysql using php -

here html part <form method="post" action="collect_vals.php"> <div id="input_fields"> <div><input type="text" name="name[]"> <input type="text" name="project[]"> <span class="fa fa-plus-circle" id="add_field"></span></div> </div> <input type="submit" value="submit"> </form> details on: jsfiddle i follow this link , can save single field data. how insert multiple data mysql. how can insert dynamic data mysql? access project names using key, this foreach($_post['name'] $key => $val) { $proj = $_post['project'][$key]; $insert = mysql_query("insert table_name (column1,colunm2) values ('$val','$proj')"); }

android - onSuccess(int, Header[], JSONObject) was not overriden, but callback was received -

i using android-async-http , , override onsuccess , onfailure method, got error: onsuccess(int, header[], jsonobject) not overriden, callback received . cz.msebera.android.httpclient.client.httpresponseexception: not found i wonder truely override method. got log: onsuccess jsonobject:{"error":null,"success":false} public static void querysecuritycode(string username) { requestparams params = new requestparams(); params.put("username", username); vstarrestclient.getclient().setenableredirects(true); vstarrestclient.post(get_security_code_url, params, new jsonhttpresponsehandler(){ @override public void onsuccess(int statuscode, header[] headers, jsonobject response) { super.onsuccess(statuscode, headers, response); log.i("ws", "---->>onsuccess jsonobject:" + response); } @override public void

html - jQuery double dropdown Navigation Issue -

i have created jquery drop down navigation wordpress multisite, navigation working great once drop down has happened once, , user clicks on dropdown link in navigation, existing drop down still showing so: double drop down occurence i'd remove drop down appearing twice when item in navigation clicked, 1 showing @ time so: single dropdown here code forming navigation: <script> jquery(document).ready(function( $ ) { jquery( ".divisionslink" ).click(function() { jquery( ".divisions-submenu" ).toggleclass( "heightnav" ); }); jquery( ".aboutlink" ).click(function() { jquery( ".about-submenu" ).toggleclass( "heightnav" ); }); jquery( ".productlinks" ).click(function() { jquery( ".products-submenu" ).toggleclass( "heightnav" ); }); jquery( ".serviceslink" ).click(function() { jquery( ".services-submenu" ).toggleclass( "heightnav" );