Posts

Showing posts from May, 2015

math - Convert a large int to a float between 0.0f and 1.0f -

i'm working on project have pane goes 0 500 on x , z, need convert coordinate (from 0 500) float in range of 0.0 1.0 in because required of functions i'm using. i'm stuck on how take axis position (lets like, 3475x3475) , change in it's relative position on plane 0.0f 1.0f (i've tried write in way programmer can understand, instead of using unity terminology. if you're unity programmer , better understand terminology tell me , i'll re-write it) you can take number ranges 0 500 , divide 500, e.g. scaled_x = x / 500.0f . depending on language , type of x need divide either 500 or 500.0f . if using language has integer division c, , if x integer x / 500 0 unless x 500, if x/500.0f float between 0.0f , 1.0f (assuming x between 0 , 500 inclusively). of course assuming want linear mapping, e.g. 0 maps 0, 100 maps 0.2, 250 maps 0.5 , on.

javascript - how to programmatically select an option as the selected option? -

i have html <select class="form-control" name="settings.provider" id="settings.provider" ng-model="settings.provider" required> <option value="" disabled selected>select provider</option> <option value="thisprovider">thisprovider</option> </select> how programmatically select "thisprovider" selected option? i tried isn't working: $scope.settings.provider = "thisprovider"; if options not bound ng-repeat, can bind each option setting in controller using ng-selected ( https://docs.angularjs.org/api/ng/directive/ngselected ). in controller, create boolean $scope.thisproviderselected each option, set true option want selected. <select class="form-control" name="settings.provider" id="settings.provider" ng-model="settings.provider" required> <option value="" disabled s

strange behavior on c++ string append -

i have strange problem c++ string object in class on line s.append(ptr2str ....); class cregexmatches { public: char *ptr2str; int *poffsets; cregexmatches() { ptr2str = null; poffsets=null;} void update(char *p, int *offsets) { ptr2str = p; poffsets = offsets; printf("ptr2str=%p %s|\n", p, p); } string operator [] (int id) { string s; printf("operator[] %p %s|", ptr2str, ptr2str); int i; (i=0; i<4; i++) printf(" %d", poffsets[i]); printf("\n"); if (!ptr2str) return s; if (poffsets[2 * id + 1] == 0) return s; int len = poffsets[2 * id + 1] - poffsets[2 * id]; printf("size %d %ld before %s\n", s.size(), len, ptr2str + poffsets[2 * id]); s.append(ptr2str + poffsets[2 * id], len); cout << s << endl; return s; } }; it runs fine follow code. int main(int argc, char *argv[]) {

java - Kafka Error fetching offset data. Reason: 1 -

i'm running java program uses kafka library , check committed offset of consumer group zookeeper every 1 sec. program runs 2 hour , starts throwing runtimeexception: java.lang.runtimeexception: error fetching offset data. reason: 1 @ com.pinterest.secor.common.kafkaclient.getmessage(kafkaclient.java:127) @ com.pinterest.secor.common.kafkaclient.getcommittedmessage(kafkaclient.java:186) ... what reason 1? couldn't find document or pages illustrating root cause of situation. check out, code fragment of kafka.common.errormapping : val unknowncode : short = -1 val noerror : short = 0 val offsetoutofrangecode : short = 1 val invalidmessagecode : short = 2 val unknowntopicorpartitioncode : short = 3 val invalidfetchsizecode : short = 4 val leadernotavailablecode : short = 5 val notleaderforpartitioncode : short = 6 val requesttimedoutcode: short = 7 val brokernotavailablecode: short = 8 val replicanotavailablecode: short = 9 val

swift - Phone reboots with lldb error -

my app can installed using xcode , can used, functionalities working. there's strange thing happening: when kill app phone or simulator restart - phone freezes, reboots after time. what notice "(lldb)" appears in console, phone becomes unusable, not respond other app launch (e.g. whatsapp, maps...). after time, phone screen turns dark relaunches. i see thread 1: signal sigkill in appdelegate class. also, in navigator, there's "(null)" after program (app) name. memory seems full! 5mb please let me know if code needed. i figured out: i killing app phone when app running , connected xcode.

How to make a batch file that resets Wi-Fi Adapter? -

my laptop has faulty wifi adapter, , every time disconnect internet (5-10 times day), have click "troubleshoot problems". windows goes through whole process find problem , resolves it, know solution reset wifi adapter. figured there specific commands in cmd that. thought make batch file run specific commands in cmd, because faster using troubleshooting feature. problem is, have no idea how program in batch. may me? had same issue, tried junaid's solution, didn't work me. this helped me, however. tl;dr: netsh interface set interface <interface name> disabled netsh interface set interface <interface name> enabled on machine < interface name> wifi, instance. does require admin rights, it's best make shortcut batch file. turned executable , pinned shortcut in taskbar.

Can I use two separate ODE call functions for a system of two differential equations in MatLab? -

Image
i trying code system of ode's shown below. as seen, second ode depends on value of first ode. how can code second ode? using ode45. yes, that's quite possible. define x [c;ce] , have like: function dx = my_ode(t,x) % parameters definition kf = ...; % whatever value using p0 = ...; % whatever value using jer = ...; % whatever value using j_serca = ...; % whatever value using gamma = ...; % whatever value using % differential equations dc = (kf*p0+jer)*(x(2)-x(1)) - j_serca; dce = -gamma*dc; dx = [dc;dce]; and can call ode solver as: tspan = [0 10]; % or whatever time interval want solve odes on x_init = [0;0]; % ot whatever initial conditions want use [t,y] = ode45(@my_ode,tspan,x_init);

linux - Inconsistent register values after setting up them in a Jprobes module -

this question in continuation previous question on intercepting elf loader . now exact problem code logic implemented within load_elf_binary function wherein @ end of function eax, ebx, ecx , edx registers set via inline asm call, before function returned. i have planted jprobe on load_elf_binary function need access struct linux_binprm *bprm argument since set register values within jprobe handler causes inconsistency when control returns actual function , application terminates segmentation fault. what possible solution ?

Register returning a hex value 1 higher than it should (8085 assembly) -

i working on assignment intro computer engineering class. trying write subroutine takes number input user , returns number in h register. from can see, works fine single digit inputs when try continue on , add one, returns (input #)+1 in h register. inputs not exceed 2 characters , not greater 20. readn: ; subroutine reads number digit user ; , returns number in h ; inputs: none ; outputs: h register push b push psw push h ; store registers in stack mvi b,0 ; 0 out b register lxi d,mess4 ; "enter number: $" call bdos ; bdos = 0005 nextn: mvi c,1 ; c = 1 --> read character call bdos cpi cr ; cr = 0dh (carriage return) jz lastn ; if input carriage return --> go lastn mvi h,10 ; set h register multiplication sui '0' ; subtract ascii 0 i

javascript - Only allow specific file extensions in angular-file-upload module to be clickable -

i'm using module, https://github.com/nervgh/angular-file-upload i using simple example, http://nervgh.github.io/pages/angular-file-upload/examples/simple/ when click "choose file" button, open window allows pick file want upload. happen allow specific file extensions clicked. there non-documented configuration that? for example, in config, allowed .txt extensions, when click "choose file" button, open window , show files. however, files doesn't have extension .txt disabled. i'm not doing security purposes. following design/instructions provided me. :) can use mitm tools intercept , allow other extensions uploaded. you can achieve goal doing this accept=".txt" <input ui-jq="filestyle" type="file" nv-file-select="" accept=".txt" uploader="uploader" data-icon="false" data-classbutton="btn btn-default" data-classinput="form-control inline v-middl

java - Why these ImageButtons(delete and update) are overlaying -

this .xml layout of item in recycleview list, last 2 buttons overlaying <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:baselinealigned="false" android:weightsum="1"> <linearlayout android:id="@+id/thumbnail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="3dip" android:layout_alignparentleft="true" android:background="@drawable/favorite" android:layout_marginright="5dip"> <imagebutton android:id="@+id/imagebutton" android:layout_width="25dip" android:layout_he

java - Spring Cloud Config Globals -

i have scenario need set properties globally several applications. there support default or global configs in spring cloud config? example: #default.properties setting=global_setting #myapp.properties something_else=app_setting #anotherapp.properties prop=different_app_setting here want "myapp" have setting set. appreciated. thanks! according the documentation properties in application.yml or application.properties available every application.

mysql - Join tables where columns have spaces in them -

i can't seem 1 working. have 2 tables want join 1 of columns has space in few of titles. trying following code out success. i have not bought in columns join yet because want test can make join. select rcm.activitydatetime, rcm.'lead id', rcm.'new stage' customername_leads_by_lifecycle_stage_rcm rcm inner join customername_leads leads on rcm.'lead id' = leads.id; the warning you have error in sql syntax; check manual corresponds mysql server version right syntax use near ''lead id', rcm.'new stage' customername_leads_by_lifecycle_stage_rcm rcm inne' @ line 1 any appreciated, thanks! use backticks (`) rather single quotes (') column names select rcm.activitydatetime, rcm.`lead id`, rcm.`new stage` customername_leads_by_lifecycle_stage_rcm rcm inner join customername_leads leads on rcm.`lead id` = leads.id; you may consider renaming columns don't have spaces.

ios - Restkit NSInternalInconsistencyException Unable to add mapping for keyPath -

fyi, i'm not familiar restkit's api. prefer other means of deserializing json domain objects; however, i've inherited project , quickest solution fix bug. i'm trying map "assignments" in below json "doctorassignments" 1-many relationship in core data. example json: { "id": 43, "time_zone": "mountain time (us & canada)", "accepting_patients": true, "auto_set_context_id": 44, "audio_notifications": false, "assignments": [ { "id": 14, "active_since": "2015-06-17t23:26:03z", "doctor": { "id": 44, "name": "darth vader psyd", "title": "dr.", "bio": "", "type": "doctor", "profile_

swift - How to have an optional trailing closure? -

i'm trying write function can call trailing closure syntax so: func hello( message: string, closure: (( msg: string ) -> void)?) { println( "called hello with: \(message)" ); closure?( msg: message ); } i expect able call function closure: hello( "abc" ) { msg in let = "def"; println("called callback with: \(msg) , i've got: \(a)"); }; and without closure, since it's optional: hello( "abc" ) the latter doesn't work. says can't call hello argument list of (string). i'm using xcode 6.3.2 , tested code within playground. i'm not sure you've got definition of optional entirely correct. doesn't mean don't need supply value closure argument; means closure can either have value (of closure in case) or nil . therefore, if wanted call hello without providing closure write: hello("abc", nil) however, can achieve you're after using defaul

javascript - AngularJS Service Undefined: Unknown provider: $scopeProvider <- $scope -

i've started learning angular js , i'm having problem injecting service controller. i'm trying put threadfactory service threadcontroller , i'm getting undefined error when calling it. advice great. error i'm getting is: unknown provider: $scopeprovider <- $scope <- threadservice app.js angular.module('threadsapp', ['ngroute']); angular.module('threadsapp') .config(function ($routeprovider, $locationprovider) { $routeprovider .when('/', { templateurl: 'views/index.html', }) .when('/selected/:topicname', { templateurl: 'views/threads.html', controller: 'threadcontroller', }) .otherwise({ redirectto: "/" }); $locationprovider.html5mode(true); }); threadcontroller.js angular.module('threadsapp').controller(

Emacs opens ibuffer or compilation in same window rather than other window -

i have been using emacs many years. past year or so, there has been annoying problem, ibuffer or compilation buffer runs in same window in. have 2 buffers open, 1 above other. want ibuffer open in 1 not in. seems pick randomly. bug or feature? can stop it? have searched answer several times, have not found one. running gnu emacs 24.5.1 in terminal. thanks. the following answer relates usage of ibuffer : the original poster may wish use keyboard shortcut bound letter o , ibuffer-visit-buffer-other-window . doc-string states function designed to: visit buffer on line in window. function ibuffer-visit-buffer-other-window uses pop-to-buffer , switch-to-buffer-other-window , should avoid window dedicated: http://www.gnu.org/software/emacs/manual/html_node/elisp/dedicated-windows.html the return key bound ibuffer-visit-buffer (which uses switch-to-buffer ), , doc-string states function designed to: visit buffer on line. if optional argument single non-nil,

ios - Is there a number limit for region based notifications? -

as per apple's doc regarding core location: core location limits 20 number of regions may simultaneously monitored single app. but region based local notification apple says: an app can have limited number of scheduled notifications; system keeps soonest-firing 64 notifications (with automatically rescheduled notifications counting single notification) , discards rest. so question there limited number region based notifications on ios? in understanding, should 64. system automatically reschedule nearest 64 region based notifications? thanks.

java - Don't copy parent pom when copying child modules -

i want exclude parent pom (where following code located) being copied when package:copy goal executed , can't find examples or figure out on own: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version>2.10</version> <executions> <execution> <id>copy</id> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactitems> <artifactitem> <groupid>${project.groupid}</groupid> <artifactid>${project.artifactid}</artifactid> <version>${project.version}</version> <type>${project.packaging}</type>

Mysql how to reduce rows by max datetime and group by non-uniqe id -

i having severe case of brain flatulence. keeping simple, have 3 tables: orders , statuses , xrefordersstatuses i've setup sqlfiddle ( sqlfiddle here ) simplified schema , redacted row data. what need orders recent xrefordersstatuses (joined statuses). can sort of using following query: select o.shopper_name_first, o.shopper_name_last, os.os_name, x.xos_order_id, x.xos_status_id, x.xos_datetime orders o inner join xrefordersstatuses x on x.xos_order_id = o.order_id left join statuses os on os.os_id = x.xos_status_id order x.xos_order_id, x.xos_datetime desc the result looks like: | shopper_name_first | shopper_name_last | os_name | xos_order_id | xos_status_id | xos_datetime | |--------------------|-------------------|---------------------|--------------|---------------|------------------------| | sally | sue | order pre-processed | 34049 | 31 | june, 18 2015 12:42:50 | | sally |

database - SQlite foreign key logic -

i using sqlite , pk column seems auto-incrementing. bit concerned following approach want normalize type -column: table: book id type name ... ... ... 15 1 foo 16 2 bar ... ... ... table: type id typename 1 magazine 2 novel what happens, if recreate type -table , pk-index (="id") changes, e.g. 1 refers novel instead of magazine . more robust, thinking inserting custom second column contains "logical" indices refer to: table: book id type name 1 3 foo 2 4 bar table: type id type typename 1 3 magazine 2 4 novel this way custom type-ids independent primary keys. think advantage of last approach not have re-ask latest (new) id of new row, because refer type column know before. way when insert row know "type" id make references (i using threads database, reading value database within method difficult or not possible (?) - if need id, have ask db first). is legit approach? or shou

java - Invalid input still updates the total -

[edit] seems moving piece of code somewhere else solve issue, can't see figure out where.. if (numleaving < min_people || numentering < min_people || totalpeople < min_people) { joptionpane.showmessagedialog(null,"invalid data"); } could explain why 'total people' still gets updated when enter invalid value such negative number? also, why total people printed anyway if user enters invalid input? final int max_people = 65; final int min_people = 0; int totalpeople = 0; int numleaving = 0; int numentering = 0; boolean invalid = true; while (invalid) { string question = joptionpane.showinputdialog("leaving or entering?"); try { // decrease total if people leaving if (question.equalsignorecase("leaving")) { numleaving = integer.parseint(joptionpane.showinputdialog("number leaving:")); totalpeople -= numleaving;

Rewrite part of javascript with C# -

i'm writing program in c# should display google maps. i'm using google maps javascript api best 1 find. program should able search places. the code: window.onload = function() { var latlng = new google.maps.latlng(52.785804, 6.897585); var options = { zoom: 15, center: latlng, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map"), options); } html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; } #map { width: 80%; height: 100%; } <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <title>google maps</title> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> </head> <body> <div id="map"> </div> </b

java - How do I get a ViewPager with focus to pass a dispatchKeyEvent() to its children views? -

i have dialog child view of viewpager have setonkeylistener() , setonclicklistener() setup. however, when child view in visible focus (it's dialog on viewpager) on app, listener never gets called on key press. further investigation seems show viewpager won't pass on dispatchkeyevent() if has focus. however, if set onkeylistener on viewpager code: mviewpager.setonkeylistener(new view.onkeylistener() { @override public boolean onkey(view v, int keycode, keyevent event) { if (event.getaction() == keyevent.action_up && event.getkeycode() == keyevent.keycode_dpad_center) { final int childindex = mviewpager.getcurrentitem(); mviewpager.getchildat(childindex).performclick(); } return false; } }); the explicit click call on child activate onclicklistener. however, shouldn't have that. event should passed down view hierarchy. accepted way deal this? having explicitly call child feels wrong.

java - Circular dependency with constructor injection -

Image
say have following components: producer produces numbers , sends messages consumer both producer , consumer send messages monitor monitor, randomly, decides when produce / consume process should stop , sends message stopper stopper stops both producer , consumer cleanly i know easy accomplish in mutable language such java. know can resolved allowing partial mutability interfaces, such described here . however, it's not practice have cyclic dependencies if possible. so, let's assume references constructor-injected , final: producer has final consumer , final monitor consumer has final monitor monitor has final stopper stopper has final producer , final consumer i found references such this , don't seem apply. how 1 go un-cycling case , cases such in general? in other words, i'm interested in how accomplish not forming cycles design standpoint. hints? you're right, won't work if dependencies final , injected via constructor.

java - Writing to a text file past a particular string -

i'm looking way write text file searching particular string , writing past it. mean want separate text file 2 sections, can write each section separate java programs. reason i'm running tests 2 different java programs , storing results in 2 text files @ moment, have them both write same place, in different sections. here code using write understand may need change in order want do. try { dateformat dateformat = new simpledateformat("yyyy/mm/dd hh:mm:ss"); calendar cal = calendar.getinstance(); string content = dateformat.format(cal.gettime()) + " test took: " + test3 + " seconds."; file file = new file("mypath\\test.txt"); if (!file.exists()) { file.createnewfile(); } filewriter fw = new filewriter("mypath\\test.txt",true); bufferedwriter bw = new bufferedwriter(fw); fw.write("\r\n"); bw.write(content); fw.write("\r\n"); bw.close(); system.

windows - Is there an easy way to capture the error code (%errorlevel%) from a nested batch script? -

i have nested batch script , want error codes percolate main batch script called it. have tried exit /b %errorlevel% but variable doesn't make back. echo'ing %errorlevel% in called batch script gives me 103, echo'ing %errorlevel% in main batch script (the next line in terms of execution) gives me 0. question has been asked on before, none of posts have worked me. edit: due poor writing, have revised question , add code see. here main batch file. if statement here never hit unless change condition other 0: call buildinstaller.cmd %sourcedir% %targetdir% %productversion% %%i if %errorlevel% neq 0 ( echo %date% %time%: build of %%i failed, halting >> %logfile% exit /b %errorlevel% ) here buildinstaller.cmd exits. have cleaned prints avoid confusion: if %errorlevel% neq 0 ( exit /b %errorlevel% ) as side note, tried doing set returnvalue=12 in called batch script, echo'ing %returnvalue% in main batch script 1 execution of program be

php include - PHP: is there any case in which "include_once" resets the stack? -

say have code: class control { function public_home() { $pagina=$this->load_public_page(); ... echo $pagina; } ... function load_public_page($localnode="") { global $language; if ($localnode != "") { $localnode="_" . $localnode; } $langlink = "http://" . page_index; if ($language != "es") { $langlink = $langlink . "/" . $language . "/"; } ob_start(); include_once 'page.php'; include_once 'header.php'; $pagina=ob_get_contents(); ob_end_clean(); return $pagina; } ... } and then, in page.php : <?php echo "lang " . $langlink; echo "node " . $localnode; ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> ...

How do I send CSRF token authenticity from a php app that I own to a rails app that I own? -

i admin sugarcrm instance , have rails app on heroku. want able automatically add contacts rails app if added in sugarcrm. have written before_save logic_hook in sugarcrm: function pushconts($bean, $event, $arguments) { $r = new httprequest('http://localhost:3000/contacts/', httprequest::meth_post); $r->addpostfields(array('first_name' => $bean->first_name, 'last_name' => $bean->last_name, 'phone' => $bean->phone_mobile,'email' => $bean->email1, )); //$r->addheaders(array('x-csrf-token'=> 'testing-csrf-token'); try { echo $r->send()->getbody(); } catch(httpexception $ex){ sugarapplication::appenderrormessage("<span style='color: red; font-size: 1.8em;'>could not save contact: rails app down.</span>"); $queryparams = array('module' => 'contacts', &#

New ( clean ) Rails project crash ( Action pack error ) -

i have created rails project : rails new project -d mysql et modify database.rb match , when try rails s -b 0.0.0.0 end access local.dev:3000 ( vagrant machine ) have issue. started "/" 192.168.56.1 @ 2015-06-18 21:25:47 +0000 cannot render console 192.168.56.1! allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255 argumenterror (wrong number of arguments (2 1)): actionpack (4.2.1) lib/action_dispatch/http/request.rb:338:in `parse_query' rack (1.6.3) lib/rack/request.rb:191:in `get' actionpack (4.2.1) lib/action_dispatch/http/request.rb:300:in `get' actionpack (4.2.1) lib/action_dispatch/http/parameters.rb:14:in `parameters' actionpack (4.2.1) lib/action_dispatch/http/filter_parameters.rb:37:in `filtered_parameters' actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:22:in `process_action' actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action' activerecord (4.2.1) lib/ac

VBA: Function for returning specific Outlook folder? -

i want search specific emails in specific folders, these folders have different sub-levels , not same parent folder. so have function give me outlook folder object given folder name. does exists? findfolder(str_foldername string) outlook.folder so can write objfolder = findfolder("myfolder") all solutions i´ve found or come weren´t flexible needed. are looking counterpart of mapifolder.fullfolderpath property (returns \\user@domain.name\rss feeds\stack overflow ) return folder given path? you can write function converts path array/list , recursively processes list starting namespace.folders collection. need take care of special character encoding (e.g. %20 " "). if using redemption option, exposes rdosession .getfolderfrompath function.

c# - How to recognize a WOL (Wake On Lan) request while the PC is running -

i wonder if possible check if wol-request has been received during computer turned on . (pinvoke, c#?) if computer receives magic paket , boots, windows writes corresponding event-log entry system-log. the way i'm looking not listen udp-traffic own - if possible want know how receive kind of system event (irq?) or something.. , thats when receiving pc turned on. i agree duston wol layer 2 combined hardware thing. on normal working pc, there little chance nic hardware pass on drivers, task of hardware disturb cpu if needed. best chance see magic packet on working pc : install , run sniffer (packet analyzer) software. force supportive nic special mode transfers every packet cpu. if can see magic packet in output, next step configure sniffer alert in case sees magic packet. done. quite cpu-intensive. write software performs this, rewriting complete sniffer fixed query instead of configurable one.

javascript - How to make text appear in separate div onClick for area of Image Map? -

so have image map , i'm trying make sections of image map clickable when area clicked, text appear on side of image in separate div. all have image map: <div id="aside"> <img src="{{ 'image.jpg' | asset_url }}" alt="" usemap="#map" /> <map name="map" id="map"> <area alt="" title="" href="#" shape="rect" coords="33,110,395,217" /></a> <area alt="" title="" href="#" shape="rect" coords="35,222,395,321" /></a> <area alt="" title="" href="#" shape="rect" coords="34,325,395,397" /></a> <area alt="" title="" href="#" shape="rect" coords="34,401,395,565" /></a> <area alt="" title="" href="#" shape="rect" c

Javascript: call dialog from button -

i hope can me, because i'm new @ javascript. want open dialog clicking on button. when shows , click "ok", there should pop-up second dialog. http://forums.asp.net/t/1962249.aspx?make+a+button+open+a+javascript+dialog and on stackoverflow saw related questions. none of them answer question: wrong or should make work? my code is: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui dialog - default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <script> $(function() { $( "#dia

Hex/Dec Program in C getting the wrong output and cant use Scanf -

whenever run program, think getting wrong output using included test strings, though think first function working. tthe files have xbits.c xbits.h , 2 versions of showxbits.c, 1 instructor provided , other 1 trying use scanf with. program supposed convert integer hex string , hex string integer. main problem is, while think code works instructor test input, know doesn't work scanf showxbits because gives answers such 0xs when 127 inputed. here xbits.c #include <stdio.h> #include <math.h> int hex_to_dec(int c) { char hex_values[] = "aabbccddeeff"; int i; int answer = 0; (i=0; answer == 0 && hex_values[i] != '\0'; i++) { if (hex_values[i] == c) { answer = 10 + (i/2); } } return answer; } /* function represents int n hexstring places in hexstring array */ void itox(char* s, int n) { char *digits = "0123456789abcdef"; i

asp.net mvc - MVC: Send parameters to Action in Controller with Bootstrap button -

view: @using (html.beginform("updatematerial", "mycontroller", formmethod.post, model.materialid)) { @html.antiforgerytoken() <input type="submit" class="btn btn-primary custom" value="derivate material" /> } controller: [httppost] public actionresult updatematerial(int? matid) { if (matid == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); } //do here } the id send null. how change this? your model.materialid should form element: @using (html.beginform("updatematerial", "mycontroller", formmethod.post)) { @html.hiddenfor(model => model.materialid) @html.antiforgerytoken() <input type="submit" class="btn btn-primary custom" value="derivate material" /> } additionally, should change action definition , make accept type of

php - ical event showing up in outlook email as "not supported calendar message.ics" -

we upgraded our php server 5.3.3 lower version. before this, had program sent out calendar event accepted or declined receiver of email. after upgrade email gives event attachment no ability accept event. shows attachment "not supported calendar message.ics." i have included code has worked couple of years. great. if ($dept) { while ($deptrow = mysql_fetch_assoc($dept)) { //$attendees .= "\r\nattendee; cn=".$deptrow['emp_name'].";role=req-participant;rsvp=false:mailto:".$deptrow['emp_email']; $attendees .= "\r\nattendee; cn=organizer;role=req-participant;rsvp=false:mailto:organizer@email.com"; //$email .= ",".$deptrow['emp_email']; $email .= ",email@email.com"; } } $from_name = $supname; $from_address = $supemail; $subject = $to

Shell command not working as expected -

i trying write shell command append ',' @ end of each line , output result new file. have written following code- sed -e 's/$/,/g' -e '$ s/,$//' name.txt > output the above code executes , places comma operator in new line, i.e. if input file is aabbcc ddeeff the output shown is- aabbcc , ddeeff instead of aabbcc, ddeeff what changes should make expected output ? tried awk '{print $0","}' name.txt > output but displays output file above.

stored procedures - Join two tables and return data from both -

i have 3 tables as. **table 1** **table 2** **table 3** lot_no(pk) lot_no(pk/fk) lot_no(fk) name job type material phone printing qty trim look @ sample data **table 1** **table 2** **table 3** 1 mian sultan xyz 1 reverse 50,000pcs 1 pvc 20 2 mian usman xyz 2 new 10,000pcs 1 ink 30 2 milky 25 2 ink 35 i want show data table 2 & table 3 on basis of lot_no. example user enter lot_no=1 result should displayed as 1 reverse 50,000pcs 1 pvc 20 1 ink 30 if user enter lot_no=2 2 new 10,000pcs 2 milky 25 2 ink 35 my query follows.... @lotnum int (variable declaratio

java - Removing HashSet with Object -

when try remove hashset takes object, hashset.contains(object) , iterator.equals(object) false, when should true. public boolean removeelement(element element) { iterator<element> itr = elements.iterator(); while (itr.hasnext()) { element oldelement = itr.next(); if (itr.equals(new element(element.estring, element.eint, element.eboolean))) { itr.remove(); return true; } if (elements.contains(new element(element.estring, element.eint, element.eboolean))) { elements.remove(new element(element.estring, element.eint, element.eboolean)); return true; } } return false; } is feature of java, bug, or coding wrong? seems logical solution removing, fails without throwing errors. itr.equals(new element(element.estring, element.eint, element.eboolean)) this always return false because you're comparing iterator element different types of objects. want co

Does Matlab support function-objects? -

trying figure out if have access function object programming techniques use in our matlab scripts. analogous .net's func type , or python's function objects . matlab give functions first class object status? matlab have function handles can passed other functions. 1 example, function fzero find zero-crossing of function give first argument. function handles can stored in variables, cell-arrays or structs. matlab has anonymous functions , similar python's lambda expressions. seems functions in matlab have properties considered first class . some random examples: >> sq = @(x) x^2 - 2 sq = @(x)x^2-2 >> fzero(sq, 1) ans = 1.4142 >> class(sq) ans = function_handle >> functions = {@(x) 2 * x, @(y) 3 * y, @exp} functions = @(x)2*x @(y)3*y @exp >> functions{2}(10) ans = 30 >> functions{3}(1) ans = 2.7183

excel - Deprecated "Filename:=cPath"? Memory Leak -

i debugging macro , have narrowed down point of memory leak (when excel stops responding , restarts) section of code: workbooks.opentext filename:=vcpath _ , origin:=437, startrow:=1, datatype:=xldelimited, textqualifier:= _ xldoublequote, consecutivedelimiter:=false, tab:=false, semicolon:=false _ , comma:=true, space:=false, other:=false, fieldinfo:=array(array(1, 1), _ array(2, 1), array(3, 1), array(4, 1), array(5, 1), array(6, 1), array(7, 1), array(8, 1), _ array(9, 1), array(10, 1), array(11, 1), array(12, 1), array(13, 1)), _ trailingminusnumbers:=true is syntax deprecated or something? there way make less demanding? after select file (the file that's being opened) error message: "run-time error '1004': "could not found. check spelling of file name, , verify file location correct..."

Reducing execution time of MySQL UPDATE -

i want optimize execution time (50 sec) of following update command. update matches join players b on a.player1_name = b.player_name set a.player1_id = b.id a.player1_id = 0 the table matches has approximately 10000 entries , table players 4000 entries. make sure have indexes on a.player1_name, b.player_name , a.player1_id.

double - Can't seem to get .doubleValue() to work (I have the latest version of Java) -

so having problem method created, called averagecost(). error is: exception in thread "main" java.lang.error: unresolved compilation problem: method doublevalue() undefined type double @ queue.averagecost(queue.java:38) @ queue.main(queue.java:47) and tried adding double value double object didn't work. found .doublevalue method can't work. added code (everything else works fine) in case clears up. have been stuck on couple days while working on other stuff please ): import java.util.linkedlist; public class queue<double> { private linkedlist<double> linklist; private string symbol; private string name; private int shares; private double price; public queue(string symbol2, string name2, int shares2, double price2) { //so far, have linkedlist works linklist = new linkedlist<double>(); shares = shares2; price = price2; symbol = symbol2; name = name2; bigadd(shares, price); } public void add(double e) {