Posts

Showing posts from September, 2012

facebook - FB.login() inside inapp browser (no popups) -

i have facebook login process working on desktop , mobile, except facebook's inapp mobile browser (ios , android). issue if call fb.login() , nothing @ happens. assume because inapp browser doesn't deal popups. i understand redirect auth flow circumvents need login/permissions popup, have built web-app, means pain deal storing users current state @ point of signing in. does have solutions this? also have tested many other sites login buttons through inapp browser, , of ones have tried far don't work. facebook has done great job of breaking large amount of sign processes. as stated in comments, seems bug either in android fb- app or in android 5 webview component. there bug report @ facebook, still working on it. solution find turn off internal browser: http://www.androidpit.com/facebook-disable-browser because action has taken user itself, it's no satisfying solution. therefore guess thing can @ moment stay tuned facebooks fix. update facebook ...

c - How to use a dll file in java code using JNA? -

i have use dll file (of c code) in java code, searched allot , found jna suitable way it. therefore, trying write helloworld program using jna-4.1.0.jar. below c code: //c hello world example #include <stdio.h> void __declspec(dllexport) _stdcall hellofromc() { printf("hello world c code! \n"); } and make dll c code using following commands on cmd: gcc -c ctest.c gcc -shared -0 test.dll ctest.o running these commands gives me dll c code, place @ root of simple java project. now here java class: import com.sun.jna.native; import com.sun.jna.library; public class helloworld { public interface ctest extends library { void hellofromc(); } public static void main(string[] args) { ctest instance = (ctest) native.loadlibrary("ctest", ctest.class); instance.hellofromc(); } } now when run java program on eclipse, getting error: exception in thread "main" java.lang.unsatisfiedlinkerror: %1 not valid win32 app...

c# - Webclient produce boundary ----WebKitFormBoundary8huFCK1rAfUxxul6 -

i have webclient , trying upload file programmatically in c#. while uploading file using real webform following problem: ------webkitformboundary8hufck1rafuxxul6 content-disposition: form-data; name="__eventtarget" ------webkitformboundary8hufck1rafuxxul6 content-disposition: form-data; name="__eventargument" ------webkitformboundary8hufck1rafuxxul6 content-disposition: form-data; name="__viewstate" the code using upload file follows: internal void uploadfile(system.io.fileinfo cvfileinfo) { if (cvfileinfo.exists == false) throw new filenotfoundexception("the specified file not found."); //i know part wrong > var values = new namevaluecollection { { "content-disposition: form-data; name=\"__eventtarget\"" , "" } , { "content-disposition: form-data; name=\"__eventargument\"" , "...

php - In Laravel Eloquent inserts an empty record to table -

i have class word extends eloquent. have added 2 records manually, , fetching fine word::all() method. when i'm trying create new object , save it, eloquent inserts empty values table. so, here model class word extends eloquent { protected $table = 'words'; public $timestamps = false; public $word; public $senserank = 1; public $partofspeech = "other"; public $language; public $prefix; public $postfix; public $transcription; public $ispublic = true; } here database migration script schema::create('words', function($table) { $table->increments('id'); $table->string('word', 50); $table->tinyinteger('senserank'); $table->string('partofspeech', 10); $table->string('language', 5); $table->string('prefix', 20)->nullable(); $table->string('postfix', 20)->nullab...

c++ - Default Parameters versus In-Class Member Initialization versus Delegating Constructors -

i make decision method should use construct complex objects multiple constructors. so pros , cons of default parameters, in-class member initialization , delegating constructors wrt each others? default parameters class defaultparams { public: defaultparams(int = 42, const std::string &b = "42") : m_a(a), m_b(b) { // things }; defaultparams(const std::string &b) : m_a(42), m_b(b) { // things }; private: int m_a; std::string m_b; }; pros: less constructors; cons: repeat code or need init() method. in-class initialization class inclass { public: inclass() { // things }; inclass(int a) : m_a(a) { // things }; inclass(const std::string &b) : m_b(b) { // things }; inclass(int a, const std::string &b) : m_a(a), m_b(b) { // things }; private: int m_a = 42; std::stri...

oracle - Create view by joining three tables in SQL -

i have 3 tables students, subjects, rank ,with data - 1) students [ name (primary)] name -------- alex greg 2) subjects [ id (primary)]: id -------- 100 101 102 3) rank [ seq (primary), name , id , rank ] seq name id rank ------ ------- ------ ------ 1 alex 100 2 greg 100 3 greg 101 b i want create view should display data as name id rank ------- ------ ------ alex 100 alex 101 z alex 102 z greg 100 greg 101 b greg 102 z so, every student , every subject, view should display rank if present in rank table, else replace null 'z' . i'm newbie sql. in forming query appreciated! cross join student , subject left outer join result rank ranks (student, subject) combination. selecting column nvl or coalesce replace null 'z'. select st.name, su.id, nvl(ra.rank,'z') rank, --coalesce(ra.rank,'z') rank ...

google app engine - PHP fails fopen if the file is large -

i'm running app on google app engine, on php. i'm using following code download file api: $context = [ "http" => [ "method" => "get", "header" => "authorization: ".$token."\r\n", "follow_location"=>1, "timeout"=>600, "ignore_errors"=>1 ] ]; $context = stream_context_create($context); $sourcefile = fopen($location,"r", false,$context) or die("no handle"); this code followed chunk read , write resource (basically i'm storing file on google storage). $destinationfile = fopen($filename,"w"); while ($buffer = fread($sourcefile, 1048576)) { fwrite($destinationfile,$buffer); } the issue code work if file small (circa below 30 mb) fopen fails if file large. have "no handle" message. it's kinda weird because explictly avoided use file_get_contents download entire file...

Dynamically modify values in data.table in R but getting only single constant value returned -

i trying modify values in data.tables in r. have come command thought job, instead puts same value in every row, while should dependent on information in row. here command: tablea[,cola := tableb[colbd == unlist(strsplit(unlist(strsplit(colc," +"))[1], "-"))[1] & colbc == unlist(strsplit(unlist(strsplit(colc," +"))[1], "-"))[2] & colbb == unlist(strsplit(unlist(strsplit(colc," +"))[1], "-"))[3] ,colba]] so want cola tablea take value of colba tableb corresponds date colc in tablea. example tablea cola colb colc 1: 600 93 2012-12-14 23:45:00 2: 600 93 2012-12-15 23:45:00 3: 600 93 2012-12-14 23:45:00 4: 600 93 2012-12-15 23:45:00 5: 600 93 2012-12-14 23:45:00 6: 600 93 2012-12-15 23:45:00 7: 600 93 2012-12-14 23:45:00 8: 600 93 2012-12-15 23:45:00 9: 600 93 2012-12-14 23:45:00 10: 600 93 2012-12-15 ...

javascript - Can't load JS into WebView in Swift -

i'm trying inject javascript web page i'm loading webview. got far this: override func webview(sender: webview!, didclearwindowobject windowobject: webscriptobject!, forframe frame: webframe!) { if (webview.mainframedocument != nil) { // && frame.domdocument == webview.mainframedocument) { let document:domdocument = webview.mainframedocument let hangoutsmode: string? = preferences.getstring("hangoutsmode") let windowscriptobject = webview.windowscriptobject; windowscriptobject.setvalue(self, forkey: "ginbox") windowscriptobject.evaluatewebscript("console = { log: function(msg) { ginbox.consolelog(msg); } }") let path = nsbundle.mainbundle().pathforresource("ginboxtweaks", oftype: "js", indirectory: "assets") let jsstring = string(contentsoffile: path!, encoding: nsutf8stringencoding, error: nil) let script = document.createelement("...

r - Adding total on top of stacked bar graphs -

Image
i creating stacked bar graph in ggplot2. have 2 questions: how can change scale of y-axis , data labels such shows in units of 1000 instead of 1? there way can make totals of counts show on top of each bar? e.g., show 94 (thousand) in bold above bar 1 , 122 (thousand) above bar 2. library(ggplot2) library(dplyr) #creating dataset my.data <- data.frame(dates = c("1/1/2014", "1/1/2014", "1/1/2014", "1/1/2014", "1/1/2014", "2/1/2014", "2/1/2014", "2/1/2014", "2/1/2014", "2/1/2014"), fruits=c("apple", "orange", "pear", "berries", "watermelon", "apple", "orange", "pear", "berries", "watermelon"), count=c(20000, 30000, 40000, 2000, 2000, 30000, 40000, 50000, 1000, 1000)) #creating positon data labels my.data <- my.data %>% ...

ios - Cannot build manual ref count CocoaPod [Resolved] -

i have ios cocoapod couple of years old pod, , several years older reusable component. built older versions of xcode. developed , remains "manual reference counting". trying import "new" project (actually reconstructed old project , manual reference counting), cannot build. as said, enclosing project manual reference counting , compiles ok way no pods installed. "automatic reference counting" set "no" in "build settings". however, even though exact same build settings "no" value present in pods project , generates compile script -fobjc-arc , , calls retain , release flagged errors. (eg, error: 'release' unavailable: not available in automatic reference counting mode .) the version of xcode 6.0.1. the version of pod 0.34.4 (installed fresh yesterday). the podspec pod in question: pod::spec.new |s| s.name = "libxxx" s.version = "1.0" s.summary = "ex...

cordova - Executing shell command on Android -

i'm wondering if cordova or plugin cordova enables me execute command in android shell? similar doing adb shell mycoolbinary -dothisstuff on desktop machine connected phone. googling returns tutorials how use cordova cli desktop application, absolutely not i'm looking for. want execute commands on phone. i ended writing own plugin. put question doing root shell executes within android app. adapted cordova. i don't have time make nice here gist: https://gist.github.com/pts93/d78ee885ee0c2f74892434008a953f8c just replace files files plugin template: https://github.com/don/cordova-plugin-hello you can in cordova app call this: shell.execute("your shell command", success, failure);

html - Modify CSS selector :after with JavaScript -

how access or modify pseudo-selectors :after , :hover of css of element through javascript (please no jquery). example <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>progress bar example</title> <style type="text/css"> .progressbar { position: relative; width: 100px; height: 10px; background-color: red; } .progressbar:after { content: ""; position: absolute; width: 25%; height: 100%; background-color: blue; } </style> </head> <body> <div id="progressbar" class="progressbar" onclick="this.style.width='90%';"></div> </body> </html> like see want us...

php - loop and split to display by 2 rows or divs -

currently , did : <?php $a = array(1,2,3,4,5,6); echo "<div>"; for($i=1;$i<=3;$i++){ echo $i; } echo "</div>"; echo "<div>"; for($i=4;$i<=6;$i++){ echo $i; } echo "</div>"; ?> how can use 1 loop , produce same output (display 2 rows 3 cols)? you can try using array_chunk() . example: $a = array(1,2,3,4,5,6); $a = array_chunk($a, 3); echo '<div>'; foreach($a $v){ echo $v[0] . $v[1] . $v[2]; echo '<br />'; } echo '</div>';

Automate Excel COM AddIns -

an excel com addin installed in computers @ workplace. whenever tries save workbook, pop-up displayed , users have select classification of workbook sensitiveinfo or nonsensitive dropdown , save. since use lots of vba macros, com addin creating problem. there way addin can automated automatically select classfication dropdown. any appreciated.

c# - how solve below issue with out key word? -

here putting example facing problem code.. here have use reference types in code. namespace outissue { class program { static int method(out int i, out int j, out int k) { = 44; j = 55; k = 67; int d = + j + k; return d; } static void main(string[] args) { int total, ,b,c; = 100; b = 200; c = 300; total = method(out a,out b, out c); console.writeline(total); } } } here method have print result of 600 total. problem out keyword initialization. in application ref not recommended , should go out keyword only.. is there alternative way other out keyword have behave "ref or out" note: not supposed use ref keyword can please me out this? if homework assignment, think have misunderstood. what have written, regardless of out keyword or ref keyword, return total of 1...

Clearcase BASE url of a file from a CI trigger -

i have file foo.c , want access it's base version. how can it? for example have foo.c@@/main/2 $env{'clearcase_pn'} gives me current file path: l:/user/vob/dir/foo.c $env{'clearcase_xpn'} gives me next version number l:/user/vob/dir/foo.c@@/main/3 how can open current base version on current view foo.c@@/main/2 ? $env{'clearcase_xpn'} should give extended path name of current version, selected current view, not "next" version. here "base" current version before ci trigger allows new 1 created. in case, cleartool descr -l $env{'clearcase_pn'} should still display 1 selected current view foo.c@@/main/2 . if not, using ' -pred ' (to previous version): cleartool descr -pred -l $env{'clearcase_pn'} the op coin confirms in comments : my $desc = 'cleartool descr $env{'clearcase_pn'}'; if($desc =~ /predecessor version:\s*(.+)$/) { die "predecessor: $env{...

sas - How to roll-up a column of data and separate values by a delimiter? -

i need transform output1 output2 . the first column how i'd break roll-ups. second column i'd roll-up. separate roll-up values / . output1 : data output1; input id $ app $; datalines; id001 app11 id001 app12 id002 app21 id002 app22 id002 app23 id003 app31 id003 app32 id004 app41 ; output2: id001 app11/app12 id002 app21/app22/app23 id003 app31/app32 id004 app41 many thanks you can use proc transpose data=trail1 out=ttrail1(drop=_name_) prefix=col; var app; id; run; %let ncols = 3; *you can vtable data res(drop=i col1 - col&ncols.); set ttrail1; length res $256; array cols{*} col1 - col&ncols.; res = col1; = 2 dim(cols); if missing(cols(i)) eq 0 res = cats(res,'/',cols(i)); end; run;

r - Lineplot legend + ABLINE ggplot -

Image
i have following ggplot , trying add legend , geom_abline @ median. purple line 2013 prods , red 2014 this did generate plot: ggplot(prods[year==2013,], aes(x = date, y = prod, group = som)) + geom_line(lwd = 1.3, colour = "purple") + ylab("actual productivity") + theme(axis.title.x=element_blank()) + geom_line(data=prods[year==2014,], aes(x = date, y = prod, group = som),lwd = 1.3, colour = "red") + geom_abline(data = prods,h=median(prod))+ scale_color_manual("period", values = c("purple","red"), labels = c("2013","2014")) + facet_wrap(~ som) i not getting error there no legend nor abline popping on image. plot looks this: any highly appreciated. regards, as per aosmith's advice: i did following , able following plot: ggplot(data=prods,aes(date)) + geom_line(data=prods[year==2013,],aes(y=prod, colour="red"),lwd = 1.3,) + geom_line(data=prods[ye...

java - Built-in Navigation Drawer Activity (on click event) -

i decided make application uses navigation drawer. created app. using built-in navigation drawer activity ( android studio ) make idea of contains, launched on phone.it works smooth but, want new activity show when press on item drawer panel. how do that? this mainactivity.java import android.app.activity; import android.app.actionbar; import android.app.fragment; import android.app.fragmentmanager; import android.content.context; import android.os.build; import android.os.bundle; import android.view.gravity; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.support.v4.widget.drawerlayout; import android.widget.arrayadapter; import android.widget.textview; public class mainactivity extends activity implements navigationdrawerfragment.navigationdrawercallbacks { /** * fragment managing behaviors, interactions , presentation of navigation drawer. ...

c - Trouble with using calloc with an array and returning a pointer -

as reference second part of assignment: int* generatefibonacci(int size); this function take input integer called size. value contained in size variable represent how many numbers in fibonacci sequence put array. function use calloc create array of size , fill array size numbers fibonacci sequence, starting 1 , 1 . when array complete function return pointer it. my trouble come in play when error in line 8 " warning: assignment makes , integer pointer without cast ". error in line 19 " warning: return makes pointer integer without cast ". so question is, how suppose set calloc make array size user, return pointer it? #include <stdio.h> #include <stdlib.h> int* generatefibonacci(int size) { int i, array[size]; array[size]=(int*)calloc(size, sizeof(int)); array[0]=0; array[1]=1; for(i = 2; < size+1; i++) array[i] = array[i-2] + array[i-1]; return *array; } void printhistogram (int array[], int s...

How can I compile STL C++ for Android using custom Makefile? -

i compiling sources android using custom makefile, along lines of: ndkdir := /path/to/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin ndkcc := $(ndkdir)/arm-linux-androideabi-gcc ndkcxx := $(ndkdir)/arm-linux-androideabi-g++ ndkflags := -i/path/to/android-ndk-r10c/platforms/android-21/arch-arm/usr/include/ %.o: %.cpp $(ndkcxx) $(ndkflags) -c $< -o $@ compiling regular c++ code works fine, includes "stl" headers, such queue fail "fatal error: queue: no such file or directory". is there way make work stl headers? i had problem too, placed three, , resolved. android.mk local_cflags := -d_stlp_use_newalloc local_c_includes += ${ndk_root}/sources/cxx-stl/stlport/stlport local_ldlibs += -lstdc++

c# - How to Load Related Entities after retrieving item from Memcache -

i'm storing object memcached using enyim. however, when pulling object out of memcached related entities null. using system.runtime.caching entities load fine. or hints store these related entities appreciated. thank you. [serializable] public class inventory { public inventory() { } public int inventoryid { get; set; } //not null public int productid { get; set; } //null enyim public virtual product product { get; set; } //null enyim public virtual icollection<warehouseinventory> warehouseinventories { get; set; } .... } you have disable dbcontext.configuration.proxycreationenabled, , make sure aggregated objects loaded when inventory object materialized. (use 'include' extension method on invetory object system.data.entity namespace)

javascript - Not working on firefox -

can body me find out, why link(webrtc example) http://goo.gl/pnmsii not working on firefox? it's working fine on chrome & opera not on firefox. i've planned build 1 photo capturing tool webcam, got stuck now. function validate(evt) { var theevent = evt || window.event; var key = theevent.keycode || theevent.which; key = string.fromcharcode( key ); var regex = /[0-9a-fa-f]|\./; if( !regex.test(key) ) { theevent.returnvalue = false; if(theevent.preventdefault) theevent.preventdefault(); } }

ios - touchesBegan called many times -

i have strange issue touchesbegan handler being called more necessary. if tapped uiview (uibutton) fast 2 times, touchesbegan called 3 times. i solved issue simple time measurement still interested reason kind of behaviour? here code (with added time-checking): override func touchesmoved(touches: nsset, withevent event: uievent) { if let t:uitouch = touches.anyobject() as? uitouch { if !cgrectcontainspoint(cgrectmake(0, 0, self.frame.width, self.frame.height), t.locationinview(self)) { touchescancelled(touches, withevent: event) } } } override func touchesbegan(touches: nsset, withevent event: uievent) { forcanceltouch = false setupbuttongui(true) } override func touchesended(touches: nsset, withevent event: uievent) { if !forcanceltouch { if abs(lastvalidtouchesbegandate.timeintervalsincenow) > delaybetweenfasttapping { nsnotificationcenter.defaultcenter().postnotificationname...

dplyr - Let treatment of NA-values depend on their number relative to the number of available values among groups in a data frame, in R -

i have got dataset containing contracts between states. number of contracting states varies 2 94. in data frame, each state attributed value called “polity” - although some, value missing. with of forum, merged 2 data frames, , summarized contracts taking difference of min() , max() "polity"-values of contracting states. now, don't want either ignore or exclude na-values. want treat polity value of contract na if number of na-values among contracting states exceeds fraction of number of contracting states (for these data frames, convenient 4/5 of polity-values must available in order contract taken in analysis). these 2 simplified versions of data sets: treaties <- data.frame(treaty.id=c(1,1,2,2,3,3,3,4,4,4,4,4), treaty=c("hungary slovenia 1994", "hungary slovenia 1994", "taiwan hungary 1994", "taiwan hungary 1994", "treaty of izmir 1977...

phpstorm - Bug with HTML/PHP syntax highlighting -

Image
i'm using phpstorm 6.0.3. max 6.x. there's random bug syntax highlighting when php inside html: on lines works, on doesn't... text code copy/paste: <a href="<?php echo $_product->getproducturl() ?>" title="<?php echo $this->striptags($this->getimagelabel($_product, 'small_image'), null, true) ?>" class="product-image"> <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->striptags($this->getimagelabel($_product, 'small_image'), null, true) ?>" /> </a> <?php if ($is_packs) { ?> <div class="pictos"> <?php if ($_product->getattributetext('heure_conso')) echo '<div class="heure-conso"...

c++ - Quaternion to Euler angles conversion regarding rotation sequence -

this have: i have vector3d class represents vector or point in 3d space. i have quaternion class performs calculus on quaternions, , can create rotation unit quaternion angle-axis representation using static method quaternion::fromangleaxisrotation(double angle, vector3d axis) . i have eulerangles class alpha, beta, gamma angles, , in constructor must specify rotation sequence, can 1 of canonical 12 (xzx, yxz, zyx ecc). private member have array of 3 elements vector3d specifies rotation sequence axis. i.e. zyx rotation have axes[0] = vector3d(1,0,0); axes[1] = vector3d(0,1,0); axes[2] = vector3d(0,0,1); . xzx rotation sequence have axes[0] = vector3d(1,0,0); axes[1] = vector3d(0,0,1); axes[2] = vector3d(1,0,0); , on. the class eulerangles has method getquaternion() . allows calculate corresponding quaternion having 3 rotation angles , rotation sequence. in order work, method creates 3 ordered quaternion instances using quaternion::fromangleaxisrotation static method f...

java - ResultSet.next() is taking too much time for few records -

i'm using ojdbc(v7) connect oracle(11g) , in java . in cases on big tables, resultset can not fetch data in appropriate time. for example output records 2, on resultset.next() java freezes , waits long! note1: the problem not setting fetchsize() , rsultset.typex , not using connection pools c3p0 , ... . i've tested of those. note2: also when run query directly in navicat , result shown perfectly! getting connection method: public connection getdbconnection() throws dbconnectionexception { connection conn = null; string connectionurl; try { class.forname("oracle.jdbc.driver.oracledriver"); conn = drivermanager.getconnection("jdbc:oracle:thin:user/pass@xxx.xxx.xxx.xxx:1521:dbname"); } catch (exception e) { e.printstacktrace(); throw new dbconnectionexception(); } return conn; } connectiong db part: ... conn = connectionmanage...

scala - Discard values while inserting and updating data using slick -

i using slick play2. have multiple fields in database managed database. don't want create or update them, want them while reading values. for example, suppose have case class mappeddummytable(id: int, .. 20 other fields, modified_time: optional[timestamp]) which maps dummy in database. modified_time managed database. the problem during insert or update , create instance of mappeddummytable without modified time attribute , pass slick create/update like tablequery[mappeddummytable].insert(instanceofmappeddummytable) for this, slick creates query insert mappeddummytable(id,....,modified_time) values(1,....,null) and updates modified_time null, don't want. want slick ignore fields while updating , creating. for updating, can tablequery[mappeddummytable].map(fieldstobeupdated).update(values) but leads 20 odd fields in map method looks ugly. is there better way? update: the best solution found using multiple projection. created 1 projection va...

sql - Error converting data type nvarchar to bigint - caused by join -

i've found thousands of issues error converting data type nvarchar bigint no solution specific problem. have generic table dynamicarticle_parameterresult value field can contain (numbers / text). if subqueries based on join (articleresultid = daar.id) 'error converting data type nvarchar bigint': select osl.groupname maingroupname, daar.saleslineid, daar.salesid, daar.id, spt.number + 1 subno, (select value dynamicarticle_parameterresult dynamicarticle_parameterresult_9 (articleresultid = daar.id) , (name = 'panel_dx')) panel_dx, (select value dynamicarticle_parameterresult dynamicarticle_parameterresult_8 (articleresultid = daar.id) , (name = 'panel_dy')) panel_dy, (select value dynamicartic...