Posts

Showing posts from June, 2010

android - Gallery thumbnails not visible on Samsung Galaxy S3 -

this driving me nuts, because when create in android picture , save on motorola g, shows ok in gallery. when execute code on samsung galaxy s3, appears folder called "camera" unknown file type. as can see on pretty-spaghetti-code, create file: //insert image , create thumbnail it. // // @param cr // content resolver use // @param source // stream use image // @param title // name of image // @param description // description of image // @return url newly created image, or <code>null</code> if // image failed stored reason. // public final string insertimage(contentresolver cr, bitmap source, string title, string description, long time) { contentvalues values = new contentvalues(); values.put(images.media.title, title); values.put(images.media.description, description); values.put(images.media.mime_type, "image/jpeg"); values.put(images.media.date_taken, ...

php - Posting to Facebook via Website Application - Internal Server Error -

i using following code user's posts, app_id, , app_secret replaced appropriate fields. <?php session_start(); require_once __dir__ . '/src/facebook/autoload.php'; $fb = new facebook\facebook([ 'app_id' => 'app_id', 'app_secret' => 'app_secret', 'default_graph_version' => 'v2.5',]); $helper = $fb->getcanvashelper(); $permissions = ['user_posts']; // optionnal try { if (isset($_session['facebook_access_token'])) { $accesstoken = $_session['facebook_access_token']; } else { $accesstoken = $helper->getaccesstoken(); } } catch(facebook\exceptions\facebookresponseexception $e) { // when graph returns error echo 'graph returned error: ' . $e->getmessage(); exit; } catch(facebook\exceptions\facebooksdkexception $e) { // when validation fails or other local issues echo 'facebook sdk returned error: ' . $e->getmessage(); exit; } if (isset($accesstoken)) { if...

c - Does accessing an array of uint32_t with an uint16_t* lead to undefined behavior? -

i have following ostensibly simple c program: #include <stdint.h> #include <stdio.h> uint16_t foo(uint16_t *arr) { unsigned int i; uint16_t sum = 0; (i = 0; < 4; i++) { sum += *arr; arr++; } return sum; } int main() { uint32_t arr[] = {5, 6, 7, 8}; printf("sum: %x\n", foo((uint16_t*)arr)); return 0; } the idea being iterate on array , add it's 16-bit words ignoring overflow. when compiling code on x86-64 gcc , no optimization seem correct result of 0xb (11) because it's summing first 4 16-bit words include 5, , 6: $ gcc -o0 -o castit castit.c $ ./castit sum: b $ ./castit sum: b $ with optimization on it's story: $ gcc -o2 -o castit castit.c $ ./castit sum: 5577 $ ./castit sum: c576 $ ./castit sum: 1de6 the program generates indeterminate values sum. i'm assuming position it's not compiler bug now, lead me believe there undefined behavior in program, can't point specific thing lead it. not...

php - Internal style not working for my pdf -

$pdf = new pdf([ // set use core fonts 'mode' => pdf::mode_core, // a4 paper format 'format' => pdf::format_a4, // portrait orientation 'orientation' => pdf::orient_portrait, // stream browser inline 'destination' => pdf::dest_browser, // html content input 'content' => $content, // format content own css file if needed or use // enhanced bootstrap css built krajee mpdf formatting 'cssfile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', // css embedded if required 'cssinline' => '.kv-heading-1{font-size:18mm}', // set mpdf properties on fly 'options' => ['title' => 'title'], // call mpdf methods on fly 'methods' => [ ...

django - Cross-database relations using UUID for PK -

it says here foreignkeys across databases can't done because of referential integrity: https://docs.djangoproject.com/en/1.9/topics/db/multi-db/#cross-database-relations could overcome using uuid's primary key? i'm guessing either don't understand referential integrity, or i'm not first think of , can't done reasons don't know yet. a foreign key means "make sure value in column exists in column". doesn't work cross-database in postgresql, databases cannot "see" each other. work cross-schema though - use qualified schema_name.table_name. why trying refer column in database?

telerik - Kendo Grid Mobile with JSP Wrappers -

i cannot mobile adaptive grid features work using kendo jsp wrappers. have cut down as possible, , not work wrappers. can working fine javascript. following works fine: <div id="grid"></div> <script> var gridconfig = { columns: [ {field: "name", title: "name"}, {field: "age", title: "age"} ], filterable: true, columnmenu: true, mobile: true }; $("#grid").kendogrid(gridconfig); </script> when @ grid in desktop browser, filter , column menus appear expect. when view grid on cell phone, filter , column menus push grid aside , appear standard mobile selection list. if create same grid using jsp wrappers, doesn't work: <div id="grid"> <kendo:grid name="grid" filterable="true" columnmenu="true" mobile="true" > <kendo:grid-columns> ...

angularjs - Cordova and Ionic SMS Receiver -

good day, have idea how achieve in ionic? found tutorials phonegap 3 years ago , dont know if work ionic app. ng-cordova has http://ngcordova.com/docs/plugins/sms/ send sms not receive. saw have no idea how use it. https://github.com/floatinghotpot/cordova-plugin-sms/tree/master/docs . please help. ionic new lacks tutorials. in case you're trying kind of application app store, have bad news you. as this answer states : simply 2 words apple: not possible

Merge two objects in php -

i use api returns me email address given array this: stdclass object ( [status] => ok [contact] => stdclass object ( [id] => 0000000 [email] => toto@free.fr [last_activity] => 1362131446 [last_update] => 0 [created_at] => 1356617740 [sent] => 5 [open] => 1 [click] => 1 [spam] => 0 [bounce] => 0 [blocked] => 0 [queued] => 0 ) [lists] => array ( [0] => stdclass object ( [active] => 1 [unsub] => 1 [unsub_at] => 1363078528 ) ) ) how merge info [contact] [lists] [0] in single object? thank help $info = yourstuff; $arrcontact = (array) $info->contact; $arrlist = (array) $info->lists[0]; $merged = array_merge($arrcontact, $arrl...

python - In pandas how to filter based on a particular weekday and range of time -

my data frame looks this.the notebook here c/a unit scp daten timen descn entriesn exitsn 0 a002 r051 02-00-00 08-18-12 00:00:00 regular 3759779 1297676 1 a002 r051 02-00-00 08-18-12 04:00:00 regular 3759809 1297680 2 a002 r051 02-00-00 08-18-12 08:00:00 regular 3759820 1297701 3 a002 r051 02-00-00 08-18-12 12:00:00 regular 3759879 1297799 4 a002 r051 02-00-00 08-18-12 16:00:00 regular 3760073 1297863 5 a002 r051 02-00-00 08-18-12 20:00:00 regular 3760367 1297920 6 a002 r051 02-00-00 08-19-12 00:00:00 regular 3760494 1297958 7 a002 r051 02-00-00 08-19-12 04:00:00 regular 3760525 1297962 8 a002 r051 02-00-00 08-19-12 08:00:00 regular 3760545 1297983 9 a002 r051 02-00-00 08-19-12 12:00:00 regular 3760603 1298048 10 a002 r051 02-00-00 08-19-12 16:00:00 regular 3760750 1298104 11 a002 r051 02-00-00 08-19-12 20:0...

Can Twilio pass multiple caller IDs? -

in app, call originates customer calling office number, , office number forwarding twilio number assign. can twilio pass me both originating number , office number forwarded (and distinguish between two)? twilio evangelist here. i'd suggest checking forwardedfrom parameter twilio includes in http request voice request url. https://www.twilio.com/docs/api/twiml/twilio_request#synchronous-request-parameters just know not perfect because not every carrier passes originating number when forward call. hope helps.

DB2 update using inner join -

i want make update statement on db2 table using inner join try update table1 set fieldvalue='text/html' table1 t1 inner join table2 t2 on t1.profile_id = t2.profile_id inner join table3 t3 on t2.msgtype_id = t3.msgtype_id t1.name='contenttype' , t3.name='order'; i mention select works fine select * table1 t1 inner join table2 t2 on t1.profile_id = t2.profile_id inner join table3 t3 on t2.msgtype_id = t3.msgtype_id t1.name='contenttype' , t3.name='order'; thanks! db2 doesn't allow "update + join" syntax. but, can rewrite sql (not tested): update table1 set fieldvalue='text/html' table1.primary_key in ( ( select t1.primary_key table1 t1 inner join table2 t2 on t1.profile_id = t2.profile_id inner join table3 t3 on t2.msgtype_id = t3.msgtype_id t1.name='contenttype' , t3.name='order' );

html - How to position the Popup window so that the Top= Top of the text & Left= left of the text + length of the text in Javascript? -

Image
ok, got simple html code this text <a href="javascript:window.open('abc.html','width=500,height=350')"> <img src="http://www.clipartbest.com/cliparts/9iz/gaj/9izgaj9ie.gif" alt="show" height="15" width="15" /></a> i want when user clicks on image show following picture: i don't jquery stuffs, so could using simple javascript code? less code possible? otherwise can use popup.js comes bootstrap package you can download site http://getbootstrap.com/ should work you. if don't know bootstrap read @ http://www.w3schools.com/bootstrap/default.asp

android - POST a file with other form data using HttpURLConnection -

im trying post file api of mine along other parameters. eg. post /media parameters filename = 'test.png' file = -the-actual-file- i can postman (using form-data), api side of things fine. here android code using httpurlconnection: namevaluepairs.add(new basicnamevaluepair("filename", "test.png")); url object = new url(url); httpurlconnection connection = (httpurlconnection) object.openconnection(); connection.setreadtimeout(60 * 1000); connection.setconnecttimeout(60 * 1000); string auth = username+":"+password; byte[] data = auth.getbytes(); string encodeauth = "basic " + base64.encodetostring(data, base64.default); connection.setdoinput(true); connection.setdooutput(true); connection.setusecaches(false); connection.setrequestproperty("authorization", encodeauth); connection.setrequestproperty("accept", accept); connection.setrequestmethod("post"); connec...

node.js - Information needed for 3D reconstruction from x-ray images using OpenCV -

anyone know starting point check out, 3d reconstruction x-ray images/2d images using opencv. im trying project using nodejs , js version of opencv. trying recreate bone structure 2d x-ray image(multiple views available). open source codes(in python/c/c++)/algorithms/guides/anything appreciated. thank you typically have following: n image layers each image dimension = width * height interpretation color value "thickness value" the general idea is: create 3d map of dimension n * width * height either floating point or byte values. add image layers map, giving huge 3d texture. can define tissue-thickness interested in, example bones. search each cell in 3d map values differ "less bone-thickness" "bigger or equal bone-thickness" (or cells have exact thickness value stored) , mark cells "bones". have voxel grid of bones :) a better approach use marching cubes , interpolate between thickness changes. probably, if google ...

How to set value of age textbox by using javascript/jquery -

i have <input type="text" name="age" value="" enabled="false">` paired `<input type="date" name="birthdate"> i want set age text box value difference of present date , date user has inputted automatically date using either javascript or jquery try : can calculate age on change of birth date selected user. take difference between time , calculate year , month . note - calculated year , month approximate, op should change code accordingly. $(function(){ var calculateage = function(time){ var months = math.round(time/(24*60*60*1000*30)); //alert(months); var years = parseint(months / 12); //alert(years); months = months % 12; return years +" yrs , " + months + " months"; }; $('input[name="birthdate"]').change(function(){ var birthdate = new date($(this).val()).gettime(); var presentdate = new date().gett...

How to write a list of integers to a file as 16 bit values in Elixir -

i have list of integers values between [0-65535]. need write these file 16 bit integers. how do in elixir? i have searched, confused ints , binaries , how perform conversion 16 bit values. i have found how convert 16 bit binary: <<12345 :: size(16)>> you can alternatively use streams: [1, 2, 3] |> stream.map(&<<&1::16>>) |> enum.into(file.stream!(filename)) this uses short form ::16 instead of ::size(16) . file stream take care of opening , closing file automatically.

css - tinymce is changing the html code -

hi using tiny mce major version 3 in application. below code initialize tinymce. <!doctype html> <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script> <script> tinymce.init({ width : "100%", height : "100%", theme : "advanced", selector :"textarea#elm1", plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks", paste_retain_style_properties : 'all', valid_children : "+span[div],+var[div|p]", forced_root_block : "", theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,undo,redo,|,bullist,n...

css - Prevent float element push other element -

my code this: <div class="padding5"> <div id="div1" class="float_left wh50"></div> <div id="div2" class="float_left h50">long text goes right here, lorem ipsum dolor sit amet.long text goes right here, lorem ipsum dolor sit amet.long text goes right here, lorem ipsum dolor sit amet.long text goes right here, lorem ipsum dolor sit amet.</div> <div id="div3" class="float_right wh50"></div> <div id="div4" class="float_right wh50"></div> <div class="clear"></div> </div> and css this: <style> .padding5{padding:5px;} .wh50{width:50px;height:50px;} .h50{height:50px;} .float_left{float:left;} .float_right{float:right;...

c# - How to Create a Simple If Condition Syntax in Crystal Report Formula that Returns a String Value -

can learn crystal reports formula syntax have made code keeps saying error 'there error in formula'. i have already: if {dataset.gender} = "male" // return string x end if i have tried researching right 1 syntax , seems have written right 1 still not working why it? can fix syntax on how return x value if it's male in crystal reports formula. remove "end if" formula if {dataset.gender} = "male" then // return string x

ab initio - In AbInitio, will join take the same time to process matched records as that of unmatched one? -

in abinitio etl tool, if there inner join component , million records matched on keys, there simple transformation logic in join , rejected records collected process further. will join take same time process records if matched compared unmatched? in general, everything, run test, , see. if think it, having records joined should run faster compared no joins. reason being once join, can discard (inner) records, , not prescient in next iteration of trying find match. resulting in less computational workload.

reactjs - Rendering React components from strings -

i trying create single-page app blog using react. want store blog posts in database. typically, can store blog post in database html , render page, can't think of how work react. here code showing want do: class blogpost extends react.component { componentdidmount() { // pretend string comes server // , mycustomtextfield defined elsewhere var blogpoststring = "<mycustomtextfield content="some content" />"; // render react components page reactdom.render(blogpoststring, this.refs.someref); } render() { return ( <div ref="someref"></div> ); } } obviously doesn't work since need converted jsx, wondering if there way along these lines, or how else recommend doing it. another option thought of store blog post array of json objects each entry includes name of component , attributes, creating them name this lookup table name component mapping. ultimately feel none of ideas i've ...

Android : Can I make an overlay object above the mouse pointer layer? -

in android wanna make overlay object above mouse pointer. => mouse pointer under overlay object i float overlay object(image) windowmanager (service). if click overlay image, of course overlay image clicked. don't want this. hope if click overlay image, below object clicked. now mouse pointer in top layer. want make overlay object on mouse pointer layer. mouse pointer ===================== overlay object(image) ===================== object1, object2 ...... ... -> overlay object(image) ===================== mouse pointer ===================== object1, object2 ...... ... enter image description here android display overview enter image description here android display sideview (layer view, layer architecture) but! wanna make mouse pointer layer down. enter image description here

string - Ruby: extract substring between 2nd and 3rd fullstops -

i constructing program in ruby requires value extracted between 2nd , 3rd full-stop in string. i have searched online various related solutions, including truncation , prior stack-overflow question: get value between 2nd , 3rd comma , no answer illustrated solution in ruby language. thanks in advance. list = my_string.split(".") list[2] that think. first command splits list. second gets bit want

java - Schedule the same task for different time interval -

is possible schedule 1 task different time intervals? here fixed interval example: timer gtimer = new timer(); calendar startdate = calendar.getinstance(); startdate.set(calendar.hour_of_day, 9); startdate.set(calendar.minute, 45); startdate.set(calendar.second, 00); scheduleclass scheduleclass = new scheduleclass(); gtimer.schedule(scheduleclass, startdate.gettime(), 1000 * 60 * 2); //interval 2 minutes this snippet of scheduleclass has run function , successful run every 2 minutes. question is: how can set interval every 2, 5 , 7 minutes? when copy scheduler 3 times throws error: severe: standardwrapper.throwable java.lang.illegalstateexception: task scheduled or cancelled` all suggestions welcome!

java - Tomcat doesn't start automatically in windows -

Image
i installed tomcat 6.0 in windows server 2008 r2.i setted catalina_home=c:\program files\apache software foundation\tomcat 6.0 java_home=c:\program files\java\jdk1.6.0_21. when try open startup.bat.tomcat running.i can reach localhost.but want these things automatically.when open start task manager.i cant see tomcat or apache services.just can reach command prompt method(you can see running black screen below).how open automatically without entering parameter. edit: yes,i want start tomcat system starts last edit:i found main error.windows doesnt recognize tomcat.how define tomcat windows being service? to automatically run tomcat when windows starts, need run tomcat service, documented here: https://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html https://tomcat.apache.org/tomcat-8.0-doc/windows-service-howto.html

android - Failed to display the text beside progress bar -

Image
how make test% display beside progress bar ? use android:layout_toleftof , android:layout_tostartof , doesn't work. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingtop="10dp"> <textview android:id="@+id/listproject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingend="20dp" android:paddingright="20dp" android:text="test" android:textcolor="@colo...

angularjs - angular $routeProvider with html5 -

i have problem $routeprovider when use html5mode correctly. when access /profile/: child fine, when page refreshed, on page errors. there wrong code below: app.config(function ($routeprovider, $locationprovider) { var pathviews = function (file) { return 'http://localhost/mycompany/app/views/' + file; }; var patherror = function (file) { return 'app/views/error/' + file; }; $locationprovider.html5mode(true); $routeprovider .when('/', { templateurl: pathviews('dashboard.html'), controller :'mainctrl' }) .when('/home', { templateurl: pathviews('dashboard.html'), controller :'mainctrl' }) .when('/profile/:child', { templateurl: function($routeparams) { return pathviews($routeparams.child+'.html')}, controller:'mainctrl' }) .when('/404', { templateurl: patherror('404.html...

c# - Convert type 'System.Collections.Generic.List<string>' to 'System.Collections.Generic.IList<>' -

in model account have property this public list<string> roles { get; set; } later on want property convert ilist<iapplicationuserrole<role>> , have function public ilist<iapplicationuserrole<role>> roles { { return _account.roles; // how convert in specific type intended. } } here iapplicationuserrole public interface iapplicationuserrole<trolemodel> : irole<string> trolemodel : entitymodel { trolemodel role { get; set; } string name { get; set; } } i newbie thing. looking forward help. say have implementing class like: public class applicationuserrole : iapplicationuserrole<t> t : role { public applicationuserrole() { } public user user { get; set; } public t role { get; set; } } then, you'd this: public ilist<iapplicationuserrole<role>> roles { { return _account.roles .select(r => ...

optimization - Solr Trigger Optimize And Check Progress From Java Code -

from topic there 2 ways trigger solr optimize java code. either sending http request, or using solrj api. how check progress of it? say, api returns progress of optimize in percentage or strings running/completed/failed. there such api? yes, optimize() in solrj api sync method. here used monitor optimization progress. cloudsolrclient client = null; try { client = new cloudsolrclient(zkclienturl); client.setdefaultcollection(collectionname); m_logger.info("explicit optimize of collection " + collectionname); long optimizestart = system.currenttimemillis(); updateresponse optimizeresponse = client.optimize(); (object object : optimizeresponse.getresponse()) { m_logger.info("solr optimizeresponse" + object.tostring()); } if (optimizeresponse != null) { m_logger.info(string.format( " elapsed time(in ms) - %d, qtime (in ms) - %d",...

django/python how come the module that ran this code isn't listed in the traceback? -

sometimes, maybe 30-40% of time when traceback, actual file read code isn't listed, why be? take traceback example.. traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/home/jeff/django/langalang/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() file "/home/jeff/django/langalang/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute django.setup() file "/home/jeff/django/langalang/venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.installed_apps) file "/home/jeff/django/langalang/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate app_config = appconfig.create(entry) file "/home/jeff/django/langalang/venv/local/li...

javascript - AngularJS date formating -

is chance format date in ng-repeat? trying format <div class="col-date">{{row.calendar.start | date : "dd.mm.y"}}</div> but not working. ideas how format date in ng-repeat ? thanks use moment , angular-moment , best modules out there stuff related dates. first of convert $scope.row.calendar.start date/moment object if string , use angular moment show desired date format here how can so: inside controller: $scope.row.calendar.start = moment($scope.row.calendar.start,'yyyy-mm-dd hh:mm:ss'); <div class="col-date">{{row.calendar.start | amdateformat : "dd.mm.y"}}

mysql - Query based off one element -

i given following database schema cows (cowid, cowname, cowage) cowpurchaser (purchaserid, name, address) purchaserecord (purchaserid, cowid, year) for each year, cow purchaser "farmland" purchased atleast 1 cow, find number of cows purchased. output set of tuples, indicates year , number of cows purchased "farmland" i not sure how approach this. tried select (pr.year, count(c.name)) purchaserecord pr, cowpurchaser cp, cows c cp.name = "farmland" , count(c.name) >= 1 this not giving result want. doing wrong? how can fix it? select pr.year, count(c.name) purchaserecord pr inner join cowpurchaser cp on pr.purchaserid=cp.purchaserid inner join cows c on pr.cowid=c.cowid cp.name = "farmland" group pr.year having count(c.name) >= 1

google play - Android App Update Getting Rejected for Keyword Spam -

i published android app called "never have ever". app , still live on google play. updated app once. second time tried update apk file, emailed messaging saying app has been rejected keyword spam. updated app 10 more times changing app description bare minimum. tried contacting google play. yesterday tried update app title "never have ever" "the never have ever game" hoping maybe fixed. no, contacted google play saying app reviewed , app title matched app "never have ever game". now, ridiculous me. how google didn't see other 10 updates, saw last one? how app "never have ever" fine until, 1 day got rejected? there many apps name "never have ever" on google play. have app "truth or dare" never got rejected having name "truth or dare". basically, frustrated have not been given answers google, , title , description not worth of rejection. maybe wrong, need answer. your app submission has been reje...

jsf - p:megaMenu open with p:commandButton click event -

in primefaces 5.1 want p:megamenu click open menu otherwise p:commandbutton press open it? <p:megamenu id="navigationmegamenuid" styleclass="navigationmenucolor" orientation="horizontal" autodisplay="false"> ......... </p:megamenu> <p:commandbutton value="open menu"/>

android - Clear spinner contents on button click -

i have spinner dynamically loaded data following final string[] sku = crownapplication.mdb.getallskus(qsearch); if((sku.length>=1)){ arrayadapter<string> dataadapter = new arrayadapter<string>(crowntakeorder.this,android.r.layout.simple_spinner_item, sku); dataadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); mspner.setadapter(dataadapter); } this works fine,now have button on clicking gets value , sets other fields blank e.g edittext below. problen not able clear spinner once else cleared spinner still remains old values if (!merror) { msku = mspner.getselecteditem().tostring(); qsearch =mquery.gettext().tostring(); quantity =mquantity.gettext().tostring(); string[] parts = msku.split(" - "); str1 = parts[0]; str2 = parts[1]; ...

shell - Bash: Passing parameters into environments of specific commands -

i know can pass parameters directly environment so: parameter= value command however doesn't work in case below, expect it: func() { char in b c echo $char done } while ifs= read line echo "char: $line" done <<< $(func) this has output: char: b c once this: ifs= while read line echo "char: $line" done <<< $(func) it works fine. output is: char: char: b char: c however have reset ifs parameter, circumvent. , i'd know reason behind this. i use gnu bash, version 4.3.42(1)-release (x86_64-apple-darwin15.0.0) this fixed in upcoming 4.4 release of bash . bash-4.4$ func() > { > char in b c > > echo $char > done > } bash-4.4$ bash-4.4$ while ifs= read line > > echo "char: $line" > done <<< $(func) char: char: b char: c making here strings work (i.e., documented) bit of on-going process.

python - Combining lists of tuples based on a common tuple element -

consider 2 lists of tuples: data1 = [([x1], 'a'), ([x2], 'b'), ([x3], 'c')] data2 = [([y1], 'a'), ([y2], 'b'), ([y3], 'c')] where len(data1) == len(data2) each tuple contains 2 elements: list of strings (i.e [x1] ) a common element data1 , data2 : strings 'a' , 'b' , , on. i combine them following: [('a', [x1], [y1]), ('b', [x2], [y2]),...] does know how can this? you can use zip function , list comprehension: [(s1,l1,l2) (l1,s1),(l2,s2) in zip(data1,data2)]

visual studio 2010 - VS2010 Form being cropped at run time on Laptop -

hi have developed vs2010 application in windows 7. using installshield premier create setup.exe/msi usual. the problem splash screen being cropped on right hand side when install on laptop has screen resolution of 1366 x 768. (on desktop of 1900 x 1080 fine, both forms visible). my main form of size 1330 x 848 , appears ok albeit snug. splash screen form of size 562 x 398 should in theory fit easy form being cropped 25% on right. 75% of splash screen visible missing out "skip" button on right. form have progress bar using timer , centre logo, can't think why have bearing. i aware if form autuosize attribute, autuosize true , have tried looking in installshield parameters no avail. i have added background (and stretch fill) both forms may have bearing on matter doubt it. any appreciated, in advance. have set splash screen form startposition centerscreen in properties window? maybe mess , starts @ right side. since created in higher resolution disp...

sql - LAST_VALUE() with ASC and FIRST_VALUE with DESC return different results -

Image
i have trouble using last_value() window function in google bigquery. in understanding, following 2 columns should return same results, return different results , seems 1 first_value() correct. select first_value(status) on (partition userid order timestamp desc), last_value(status) on (partition userid order timestamp asc) [table] did make mistake? there's subtlety on how over() functions work when have (order by): work incrementally. see query: select x, y, first_value(x) over(order y) first, last_value(x) over(order y desc) last, sum(x) over() plain_sum_over, sum(x) over(order y) sum_over_order (select 1 x, 1 y),(select 2 x, 2 y),(select 3 x, 3 y),(select 4 x, 4 y) the plain_sum_over , sum_over_order reveal secret: order incremental results - , that's witnessing in results.

what can be used to find the sha2 checksum of a file in windows -

what best method getting sha2 checksum in windows? i'm looking equivalent md5sums-1.2 utility referenced putty downloads, more options md5. edit - after more searching seems sha1 sha256 sha512 have working programs outside of hashing text. want find sha2 checksum of file, no dice yet due sha2 becoming popular? you can install 7-zip 15.14 or later - 1 of new features (optionally) adds hash option windows explorer context menu, 1 of sha256 values. you can use jacksum , java program has wide variety of hashes files , entire directories. you might able use gnuwin32 believe includes sha1sum , sha256sum. if you're validating downloads check corruption, firefox downloadthemall addon check hash part of download process!

wordpress - Blog page Server error 500 with sticky post loop in query.php -

using sticky post on site near 5000 sticky post have. in wp-includes/query.php here have bellow snippet code.on line 3748 3760.if comment code blog page work properly. if uncomment blog page gives 500 error sites work fine except blog page. so can body tell me why happening , how resolve . i have try disabling plugins,changed theme , htaccess. not worked me.so 1 tell me how solve issue. // fetch sticky posts weren't in query results if ( !empty($sticky_posts) ) { $stickies = get_posts( array( 'post__in' => $sticky_posts, 'post_type' => $post_type, 'post_status' => 'publish', 'nopaging' => true ) ); foreach ( $stickies $sticky_post ) { array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) ); $sticky_offset++; ...

windows - Installing IISPowershellSnapin.26IISPowershellSnapin.exe doesn't succeed -

Image
i have downloaded iis powershell snapin iispowershellsnapin.26iispowershellsnapin.exe unfortunately installing on windows 2012 remote desktop doesn't succeed. error is: microsoft webinstaller couldn't find product tried install. either link clicked incorrect or may overwriting feed different feed. i have downloaded site: http://www.iis.net/downloads/microsoft/powershell the manual gives following prerequisites: the iis powershell snap-in requires following prerequisites: •windows server 2008, windows server 2008 r2, windows vista service pack 1, or windows 7 •microsoft powershell 1.0 or 2.0 so nothing said windows server 2012. there executable windows server 2012 or there problem. http://www.iis.net/learn/manage/powershell/installing-the-iis-powershell-snap-in i have allready checked whether iis management console installed , installed. maybe executable needs internet connection install? on our rdp have no internet connectio...

javascript - Is it possible to update a already created job in kue node js -

hi creating jobs using kue . jobs.create('myqueue', { 'title':'test', 'job_id': id ,'params': params } ) .delay(milliseconds) .removeoncomplete( true ) .save(function(err) { if (err) { console.log( 'jobs.create.err', err ); } }); every job has delay time ,normally 3 hours . now check every incoming request wants create new job , id . as can see above code , when creating job add job id job . so want check incoming id existing jobs' job_id s in queue , update existing job new params if matching id found . so job queue have unique job_id every time :). is possible ? , have searched lot no found , checked kue json api . can create , retrieve jobs , can not update existing records . thanks in advance . this not mentioned in documentation , examples, there update method job . you can update jobs job_id way: ...

ios - how to delete the Superfluous Escape-character in a NSString object -

i'm newbie development of ios. , when deal json nsjsonserialization , find problem me. nslog(@"response: %@", responsestring); nsdata *jsondata = [responsestring datausingencoding:nsutf8stringencoding]; nsdictionary *dict = [nsjsonserialization jsonobjectwithdata:jsondata options:nsjsonreadingmutablecontainers error:nil]; nslog(@"dict: %@", dict); and output is: 2013-03-18 20:13:56.228 xxxx[3550:5003] response: {"status":"success","data":"{\"title\":\"\",\"sessionname\":\"sid\",\"sessionid\":\"9217e5df3db6b4b4aa3eed800890069f\",\"rand\":5360}","md5":"292ee1e78628fc6360c647e938c4f1ea"} 2013-03-18 20:13:56.229 xxxx[3550:5003] dict: { data = "{\"title\":\"\",\"sessionname\":\"sid\",\"sessionid\":\"9217e5df3db6b4b4aa3eed800890069f\",\"rand\":5360}"; ...

c# - Session variable is reset after making a request to Web API controller -

i'm using session in web api implementing follow answer enable session in web api 2 . got problem session variables. in business object class, have property used store changed record. public class basebo { protected httpsessionstate _session; public basebo() { _session = httpcontext.current.session; } private ilist<fundinvestor> _investors; public ilist<fundinvestor> investors { { _investors = (ilist<fundinvestor>)_session["_investors"]; if (_investors == null) { _investors = new list<fundinvestor>(); _session["_investors"] = _investors; } return _investors; } set { _investors = value; _session["_investors"] = value; } } } at client, when saving form, make 2 requests server. first, call method addinvestorqueue of basebo instance list of changed records. changed records added list investors ...

How can I run an Illustrator javascript on all files in a directory? -

i'm trying use javascript update illustrator file. have script modify open file in desired way (really text find/replace, text encoded in illustrator data). problem have hundreds of these files want modified in same way in directory. there way me without having open every single 1 of these files? i figure either: 1. there's way modify existing javascript read directory , load files in background, process them, save, , close. 2. can write node.js script can wrap existing illustrator javascript, i'm not sure how recognize "application" object , read file same way when it's opened in illustrator. thanks help! edit: here's functioning script (that . function findandreplacescript_allopendocuments(){ for(var i=app.documents.length -1; > -1; i--){ app.documents[i].activate(); var adoc = app.documents[i]; var searchstring = /oldtext/gi; var replacestring = 'newtext'; ...

google code - Googlecode: View html file directly from svn source -

is possible view file real html instead of raw text in googlecode svn? ex: http://jquery-json.googlecode.com/svn/trunk/test/index.html as opposed http://dropdown-check-list.googlecode.com/svn/trunk/doc/dropdownchecklist.html somehow source code including css , scripts not processed , wrapped in big pre tag i found answer. extracted : http://manjeetdahiya.com/2010/09/29/serving-html-documentation-from-google-code-svn/ basically have set mime-type of file using svn client

ios - Modal without rounded corners? -

Image
i create modal in ios without rounded corners - modal represents uiviewcontroller in uinavigationcontroller. when ill try with: override func viewwillappear(animated: bool) { self.navigationcontroller?.view.layer.cornerradius = 0 } it not working. there solution that? edit: mean rounded corners here: that code example (removed other useless code here) already found solution. assign class rootviewcontroller , add there: override func viewwilllayoutsubviews() { super.viewwilllayoutsubviews() self.view.superview!.layer.cornerradius = 0.0 self.view.superview!.layer.maskstobounds = false } works fine.

sqlite3 - Best way to represent 3 dimensional data in sqlite table? -

i wondering if there nice way represent 3 dimensional table in sqlite. i.e. how create table in sqlite 3rd dimension: e.g.: col , row , , height ? in case, number of columns fixed, rows , height grow on demand inserting. if possible, how 1 select specific height on specific row?

c++ - Can you return an integer by dereferencing a pointer? -

int f(int *x) { *x = 5; return *x; } int main() { int * y = 0; int z = f(y); } why code give me run time error? why code give me run time error? because y null pointer, dereferenced in f() . note, undefined behaviour dereference null pointer. can return integer dereferencing pointer? yes, assuming pointer pointing valid int . example: int main() { int y = 0; int z = f(&y); }

iphone - iOS file upload - original filename -

i have simple html file upload snippet works under ios well. problem filename of uploaded file 'image.jpeg'. there way original filename - i.e. 'img_0001.jpg' instead? major issue if have 2 files selected both have name of 'image.jpeg' opposed unique names. safari on ios make name of uploaded file image.jpeg , presumably security/privacy purposes. need generate own name files, idea in general uploaded files: never want trust client much. if targeting more safari on ios, still need handle case because reasonable people might upload multiple files same name, located in different directories.

matplotlib - Plotting 3D random walk in Python -

Image
i want plot 3-d random walk in python. similar picture given below. can suggest me tool that. trying use matplotlib getting confused on how it. have lattice array of zeros x*y*z dimensional , holds information random walker has walked, turning 0 to 1 on each (x,y,z) random walker has stepped. how can create 3d visual of walk? the following think trying do: import matplotlib mpl mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot plt import random mpl.rcparams['legend.fontsize'] = 10 fig = plt.figure() ax = fig.gca(projection='3d') xyz = [] cur = [0, 0, 0] _ in xrange(20): axis = random.randrange(0, 3) cur[axis] += random.choice([-1, 1]) xyz.append(cur[:]) x, y, z = zip(*xyz) ax.plot(x, y, z, label='random walk') ax.scatter(x[-1], y[-1], z[-1], c='b', marker='o') # end point ax.legend() plt.show() this give random walk looking this:

Spring Security UserDetails and username -

in current implementation have user entity implements org.springframework.security.core.userdetails.userdetails interface. @entity @table(name = "users") public class user extends baseentity implements userdetails { private static final long serialversionuid = 8884184875433252086l; @id @generatedvalue(strategy = generationtype.auto) private integer id; private string username; private string password; .... during oauth2 authorization manually create new user object, populate fields , store in database. according userdetails contract - userdetails.getusername() method can't return null have no values retrieved social networks can used username. what value in case should returned in user.getusername() method ? is okay return ? @override public string getusername() { return string.valueof(id); } if need save entity before have valid value name think that's problem desig...

postgresql - Extracting key names with true values from JSONB object -

i'm trying select keys jsonb type true values. far managed using query feel there better way: select json.key jsonb_each_text('{"aaa": true, "bbb": false}'::jsonb) json json.value = 'true'; what don't where clause i'm comparing strings . there way cast boolean ? if yes, work truthy , falsy values too? (explanation of truthy , falsy values in javascript: http://www.codeproject.com/articles/713894/truthy-vs-falsy-values-in-javascript ). jsonb has equality operator ( = ; unlike json ), write select key jsonb_each('{"aaa": true, "bbb": false}') value = jsonb 'true' (with jsonb_each_text() rely on json values' text representation). you can include additional values, if want: where value in (to_jsonb(true), jsonb '"true"', to_jsonb('truthy')) in uses equality operator under hood.

python - Writing numpy arrays to files -

i want know if numpy has build-in functions writing files or if there method, should used writing array constructed this: [[2, 3, 4], [3, 5, 6], [8, 7, 9]] to file looks this: 2 3 4 3 5 6 8 7 9 i not sure how this. know how regular python list using loop want know way should done. you can use np.savetxt( "filename.txt", your_array ) for details see: http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.savetxt.html [update] can use formatting parameter e.g. this: your_array = [[2, 3, 4], [3, 5, 6], [8, 7, 9]] np.savetxt("filename.txt", your_array, fmt="%d")

unity3d - Get access token via Log in with google in unity -

i able login google account in unity game. i've tried using play game services, imo best solution, , can log in , name , id , stuff, can't access token used, can verify user on server. i have server lot of player-data, can't put in game services, need verify it's correct user, , id not safe enough. how can log in google , access token in unity? cheers have tried writing custom android plugin game? in unity game able on native android app, , pass data reference against server. they have pretty straightforward documentation it: http://docs.unity3d.com/manual/pluginsforandroid.html i hope helps! edit: elaborated statement.

java - How to automatically create missing folders for ImageOutputStream? -

i'm trying save jpg images custom compression. therefore using imagewriter follows: imageoutputstream os = new fileimageoutputstream(new file(filenamepath)); imagewriter jpgwriter = imageio.getimagewritersbyformatname("jpg").next(); imagewriteparam jpgwriteparam = jpgwriter.getdefaultwriteparam(); jpgwriteparam.setcompressionmode(imagewriteparam.mode_explicit); jpgwriteparam.setcompressionquality(1f); jpgwriter.setoutput(os); problem: code works if folder given in filenamepath exists, , throws filenotfoundexception if folder missing. question: how implicit let writer create target folder? you need create first. fileimageoutputstream won't create file if doesn't exist. this can done using java nio.2 api files.createdirectory(dir) . method checks if directory exists and, if not, creates it. creates new directory. check existence of file , creation of directory if not exist single operation atomic respect other filesystem activities ...

facebook - Maintenance mode still showing when sharing in Wordpress -

i have deleted plugin maintenance mode , site has been online 3 days. however, when share blog post in facebook title gives me maintenance mode. you can see example in page: http://www.cartum.org/uncategorized/desarrollo-y-docencia/ i have disabled cache plugin , have cleared cache in browser. nothing seems work. i have tried put url in https://developers.facebook.com/tools/debug tells me have errors , don´t have access ftp of web site. and in yoast seo plugin have open graph data added. what can do? adding in 2 cents -- having similar scenario placed website in mm few days make changes. have not disabled it, uninstalled plugin trying remove mm when going share on fb or twitter... what did: cbrow shared hector problem, visited: https://developers.facebook.com/tools/debug/ placed url page kept giving old maintenance mode when shared, hit " debug " , viola! self-corrected instantly. thanks help! lez

soap - What's the difference between MTOM and the attachment features provided by SAAJ? -

saaj: soap attachments api java mtom: soap message transmission optimization mechanism my simple understanding: deal soap attachments, mtom being more optimized version of saaj. correct? are 2 different ways of doing same thing? or trying compare apples , oranges here? can use saaj , mtom together? it little bit more complicated. saaj old java api used manipulate soap envelopes, sending binary attachments can done in sane way (that not base64 encoded string in message body). saaj sort of low level interface, need construct soap envelope "by hand" in code , add attachments it. if don't need work legacy code , want work directly soap envelopes, on jax-ws dispatcher , provider interfaces. mtom beast. not full web service api - specialized way of sending attachments. can used "true" web service api jax-ws or saaj (if manage force saaj work way). mtom (almost) used xop, more efficient way send binary data, compared base64 (which has l...