Posts

Showing posts from March, 2014

string - Saving struct to clipboard in C++ -

i have structure in c++ code: struct sdata { dword number; int currentnumber; bool gameover; }; i need save clipboard structure 1 process. , other process need load again structure . can easy cstrings/strings not structures . suggest me? this method setting cstring clipboard: bool settext(cstring text) { cstring source; source = text; //put text in source if (openclipboard(null)) { hglobal clipbuffer; char * buffer; emptyclipboard(); clipbuffer = globalalloc(gmem_ddeshare, source.getlength() + 1); buffer = (char*)globallock(clipbuffer); strcpy(buffer, lpcstr(source)); globalunlock(clipbuffer); setclipboarddata(cf_text, clipbuffer); closeclipboard(); return true; } else { return false; } } and getter: std::string gettext(void) const {

javascript - Regular expression improvement -

i trying write regular expression capture data, struggling finish it. from data: code:name another-code:another name i need array: ['code:name', 'another-code:another name'] the problem codes can space. i know how without using regular expressions, decided give them chance. update: forgot mention number of elements can vary 1 infinity. data: code:name -> ['code:name'] code:name code:name code:name -> ['code:name', 'code:name', 'code:name'] is suitable. just split input according space followed 1 or more non-space characters , : symbol. > "code:name another-code:another name".split(/\s(?=\s+?:)/) [ 'code:name', 'another-code:another name' ] or > "code:name another-code:another name".split(/\s(?=[^\s:]+:)/) [ 'code:name', 'another-code:another name' ]

c++ - gtest DEATH_TEST complains about fork() and threads, but only threads found had been joined -

i'm using gtest unit testing and, in particular, have death_tests assertions in debug builds. setup() test, have create object creates thread, goes off , work, returns data, , joins on object's thread. test fixture's setup() returns, allowing test body run. i've noticed death_test complain death tests use fork(), unsafe particularly in threaded context. test, google test detected 2 threads. is, of course, valid problem if there's multiple threads running . sometimes, however, no such warning exists. seems race condition. so looking it, discovered gtest using /proc/self/task pseudo filesystem discover threads. since of threads named, decided use /proc/self/task/[tid]/comm discover thread might lingering. indeed, it's exact same thread join() ed. came example source code reproduce issue 1) reproduces gtest's thread detection gtest, , 2) if target thread lingering, emits message stdout. // g++ test.cpp --std=c++11 -pthread #include <iostream

jquery - Define a minimun height when collapsing in Bootstrap -

Image
in bootstrap, want set height when collapses. want keep collapsible area shown using .collapse.in class. when collapses won't set height zero. before collapse: after collapse: update: http://jsfiddle.net/r6eaw/1158/ css: #collapseone{ min-height:60px } jq: $('#accordion').on('hidden.bs.collapse', function () { $('#collapseone').removeclass('collapse').css({ 'overflow': 'hidden', 'height': '60px' }) })

sql - Different prices per state for product -

i trying run query price of item purchased customer. issue products built @ base level 'blank' state example see below. state product price x 5.00 oh x 5.25 ca x 5.75 y 6.00 i know if im getting somewhere type of case statement , place this going join statement (case when a.state= b.state a.state else 'blank' end) edit: select o.name, o.state, o.item, i.rate orders o left join on item_desc o.item = i.item , case when o.state = i.state o.state else null end = i.state revised works null isnt working need replace catch blank field (field empty/blank not null) in case rate null , can result doing correlated sub query in case statement. sql fiddle demo select o.name, o.state, o.item, case when i.rate null ( select rate item_desc item = o.item , coalesce(state,'') =''

python - Row and column indexes of True values -

i have nxn pandas dataframe contains booleans. example: in[56]: df out[56]: 15 25 35 45 55 10 true false false false false 20 false true false false false 30 false false true false false 40 false false false true false 50 false false false false true what need collapse frame nx2 pandas dataframe has index , column values have true @ intersection record values. example: in[62]: res out[62]: 0 1 0 10 15 1 20 25 2 30 35 3 40 45 4 50 55 can't seem find simple way this. pd.melt "unpivots" dataframe wide long format: result = pd.melt(df.reset_index(), id_vars=['index']) mask = result['value'] == true result = result.loc[mask, ['index', 'variable']] result.columns = [0, 1] print(result) yields 0 1 0 10 15 6 20 25 12 30 35 18 40 45 24 50 55 ps. desired dataframe has 2 columns have values act coordinates. df.pivot method conver

AngularJS Resolve a route based on a service promise -

i using ngroute , and trying routes resolve based on result of function in service have defined my service follows: app.factory('authservice', function ($q,$location,$http) { var isloggedin = false; return { hasloginsession: function(){ var defer = $q.defer(); if(isloggedin) { //user has valid session previous getsession.json request defer.resolve(isloggedin); } else { return $http.get('/session/getsession.json').success(function(data, status, headers, config) { isloggedin = data.success; if(isloggedin) { defer.resolve(isloggedin); } else { defer.reject("ex_login_session_is_unknown"); } }). error(function(data, status, headers, config) { isloggedin=false;

c# - How to Ensure Immutability of a Generic -

this example in c# question applies oo language. i'd create generic, immutable class implements ireadonlylist. additionally, class should have underlying generic ilist unable modified. initially, class written follows: public class datum<t> : ireadonlylist<t> { private ilist<t> objects; public int count { get; private set; } public t this[int i] { { return objects[i]; } private set { this.objects[i] = value; } } public datum(ilist<t> obj) { this.objects = obj; this.count = obj.count; } ienumerator ienumerable.getenumerator() { return this.getenumerator(); } public ienumerator<t> getenumerator() { return this.objects.getenumerator(); } } however, isn't immutable. can tell, changing initial ilist 'obj' changes datum's 'objects'. static

qt - QML dictionary (jsobject, var) sub-properties notify -

is possible raise notify-method of var / variant / object / (etc.) variables automatically during updating? suppose have: property var objects: {'obj1': 'unnamed', 'obj2': 'unnamed'} next have binding in, example, text: text { text: objects.obj1 ontextchanged: objects.obj1 = text } in ontextchanged want raise notify signal of objects variable update everywhere. hm, if not mistaken, qml generates onobjectschanged signal handler objects not emitted when change objects internally, , due qml brilliant design, cannot emit objectschanged() manually, expected automatically emit, except doesn't. emits when property reassigned object. you cannot create signal js object, since requires qobject derived class signals , therefore notifications , bindings. you can force emit objectschanged() reassigning objects property new object new value obj1 , old value of obj2, force second text element update , show new value. not

php - Read urls-csv and insert them in a mysql -

i have create php script reads list of urls , insert them in mysql-database. problem inserts first line , stops. <?php $conn=mysql_connect("my_servername","my_username","my_password") or die (mysql_error()); mysql_select_db("my_dbname") or die (mysql_error()); $url = array("url1.csv", "url2.csv", "url3.csv", . . . "url15.csv", ); for ($i=0; $i<15; $i++) { $url_go = file_get_contents($url[$i]); $z = array_filter(explode("\x0a",$url_go[$i])); $counter=0; foreach($z $k=>$v) { if($metr>2) { $y=( (explode(';',rtrim($v,";"))) ); $sql = 'insert `mysql_table_name` (name_of_column_1,name_of_column_2, name_of_column_3, name_of_column_4, name_of_column_5, name_of_column_6,name_of_column_7,name_of_column_8,name_of_column_9,name_of_column_10,name_of_column_11,name_of_colu

jquery - JQUI Week picker won't start on this week -

i have week-picker [fiddle] , can't have current week selected on load. far have current day selected. also, there easier way week-picker this? here's code: var startdate; var enddate; var selectcurrentweek = function (where) { console.log(where); window.settimeout(function () { $('.week-picker').find('.ui-datepicker-current-day a').addclass('ui-state-active'); }, 1); } $('.week-picker').datepicker({ showothermonths: true, selectothermonths: true, onselect: function (datetext, inst) { var date = $(this).datepicker('getdate'); startdate = new date(date.getfullyear(), date.getmonth(), date.getdate() - date.getday()); enddate = new date(date.getfullyear(), date.getmonth(), date.getdate() - date.getday() + 6); var dateformat = inst.settings.dateformat || $.datepicker._defaults.dateformat; $(&

c - Answer is 8 but how? -

how following code work? #include <stdio.h> #include <conio.h> void main () { int n = 6, d; int func (int n) { int x, y; if (n <= 1) return n; x = func (n - 1); y = func (n - 2); return (x + y); } d = func (6); printf ("%d", d); } the answer 8 don't know why? please explain step wise step. let's build execution tree func(n) . if it's called n <= 1 , returns n . otherwise, returns func(n-1)+func(n-2) . so, func(6)= func(5)+func(4)= func(4)+func(3)+func(3)+func(2)= func(3)+func(2)+func(2)+func(1)+func(2)+func(1)+func(1)+func(0)= func(2)+func(1)+func(1)+func(0)+func(1)+func(0)+func(1)+func(1)+func(0)+func(1)+func(1)+func(0)= func(1)+func(0)+func(1)+func(1)+func(0)+func(1)+func(0)+func(1)+func(1)+func(0)+func(1)+func(1)+func(0)= 1+0+1+1+0+1+0+1+1+0+1+1+0= 8

Initiating an instance of PopupWindow as a class from a fragment in Android -

i've been getting null pointer exception when try , call showpopup2 firstfragment. showpopup class, public class showpopup extends activity { public void showpopup2(view v) { button btndismiss; layoutinflater layoutinflater = (layoutinflater)showpopup.this.getsystemservice(context.layout_inflater_service); view layout = layoutinflater.inflate(r.layout.popup_layout, null); popupwindow popupwindow = new popupwindow(layout, 580, 500, true); popupwindow.showatlocation(layout, gravity.center, 0, 40); btndismiss=(button) layout.findviewbyid(r.id.btndismissxml); btndismiss.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0){ popupwindow.dismiss(); } }); } } and fragment, public class firstfragment extends fragment implements onclicklistener{ public static context context; button btnpopup; public showpopup showpopup; @override public void oncreate(bundle saveddataentryinstancestate){

Microsoft Visual Studio 2012 - Navigate To (Ctrl + comma) shortcut not using selected text -

in visual studio, pressing ctrl+comma brings navigate window. normally, use selected text input when use shortcut, uses else. i think uses last thing copied clipboard first file have open. i figured out writing question. i had find prompt open on 1 of open files ( ctrl + f ). navigate window using text rather selected text. closing find prompt resumed normal behavior ctrl + comma shortcut.

postgresql - Rails string dont allow empty string value in DB on create -

i have model looks in schema.rb create_table "runs", force: true |t| ... t.string "label", default: "default run title", null: false ... t.datetime "timestamp" end however, when create new run leaving label field blank in form, stores run like: => #<run... label: "", .....> i want force default value set default: "default run title if string passed empty string. what missing? i suppose can use validator method or before_save or something, i'd rather have model govern behavior since within realm of default => supposed thought... putting junk in database schema really, annoying. if later need change phrasing? need run migration. if want phrasing change based on user's language? need write hack work around it. what's better put in model: before_validation :assign_default_label then later have method defaults it: def assign_default_label return if (self.labe

xml - XLM.transforming HTML with XLS -

i need help. i have xml file : <conferences> <conference> <edition> <titre>titre 1</titre> <date>2005</date> </edition> </conference> <conference> <edition> <titre>titre 2</titre> <date>2004</date> </edition> </conference> <conference> <edition> <titre>titre 1</titre> <date>2001</date> </edition> </conference> <conference> <edition> <titre>titre 2</titre> <date>2001</date> </edition> </conference> <conference> <edition> <titre>titre 3</titre> <date>2002</date> </edition> </conference> </conferences> i wants : titre 1 : 2005 2001 titre 2 : 2004 2001 titre 3 : 2002 i have xsl file. arrive don't have title duplicates :

twitter - Social Network Dataset -

i'm working on social network mining project, , i'm looking "real social network dataset" (comments, ,comments on comment, likes, friendship, interest, feeling, places,liked pages, published photos, videos, posts, hashtags more positive ) i searched lot, available networks nodes , edges (like follow b). example http://snap.stanford.edu/ search twitter, not open because of privacy terms http://an.kaist.ac.kr/traces/www2010.html anyone have suggestion dataset? i found tutorial step step how stream twitter hadoop https://github.com/datadansandler/youtubereadme#video-5-configure-flume

c - CUDA: How do I use float audio data with cuFFT? -

i'm interested in transforming audio signal in cufft data necessary create spectrogram. seem losing of audio data when trying convert float cufftreal before transform. also, don't think actual approach correct getting correct result. here have far: void process_data(float *h_in_data_dynamic, sf_count_t samples, int channels) { int nsamples = (int)samples; int datasize = 512; int batch = nsamples / datasize; cuffthandle plan; //this makes data become 0's. cufftreal *d_in_data; cudamalloc((void**)&d_in_data, sizeof(cufftreal) * nsamples); cudamemcpy(d_in_data, (cufftreal*)h_in_data_dynamic, sizeof(cufftreal) * nsamples, cudamemcpyhosttodevice); cufftcomplex *data; cudamalloc((void**)&data, sizeof(cufftcomplex) * nsamples); cufftcomplex *hostoutputdata = (cufftcomplex*)malloc((datasize / 2 + 1) * batch * sizeof(cufftcomplex)); if (cudagetlasterror() != cudasuccess) { fprintf(stderr, "cuda error: failed allocate\n"); return; } int rank

ios - Root View Controller discrepancy between iOS7 and iOS8 -

my app crashing on ios7 since reason rootviewcontroller uinavigationcontroller instead of uisplitviewcontroller . app crashes on first line let splitviewcontroller = self.window!.rootviewcontroller uisplitviewcontroller in appdelegate . there fix or workaround this? works fine on ios8 okay issue uisplitviewcontroller used ipads, not iphones. make sure target under project set ipads if need have uisplitviewcontroller. if want support both devices recommend checking see device idiom app running on launch , alternate between 2 storyboards (if make sure target universal devices instead of ipad). <--- covers ios 7 support, , reason app not crashing on ios 8 because uisplitviewcontroller allowed on ios devices when not allowed on iphones in ios 7.

Why does the Rust compiler generate huge executables? -

compiling simple hello world application this: fn main() { println!("hello, world!"); } generates relatively huge 822 kb executable using default compiler options ( rustc hello.rs ). why happen , best way reduce size of executable? the standard library linked statically default. can change passing -c prefer-dynamic option compiler. rust still young language incompletely optimized compiler. there still lot of room left improvements in compilation speed, code speed , size, wording of error messages , on.

html - Django bower, bootstrap, staticfiles doesn't work -

i have problem loading static files django template. here settings: installed_apps = ( 33 'django.contrib.admin', 34 'django.contrib.auth', 35 'django.contrib.contenttypes', 36 'django.contrib.sessions', 37 'django.contrib.messages', 38 'django.contrib.staticfiles', 39 'chat', 40 'ws4redis',

java - Return a random line from a text file -

i want make mad libs program write mad libs template , computer fills in blanks you. i've got far: package madlibs; import java.io.*; import java.util.scanner; /** * * @author tim */ public class madlibs { /** * @param args command line arguments */ public static void main(string[] args) throws ioexception { file nouns = new file("nounlist.txt"); scanner scan = new scanner(nouns); while(scan.hasnextline()){ if("__(n)".equals(scan.nextline().trim())){ int word = (int) (math.random() * 100); } } } } the nounlist.txt file contains list of nouns, each on separate line. question is: how use math.random function choose line used? get nouns in list, , choose random element out of list. example: // nouns contain list of nouns txt file list<string> nouns = new arraylist<>(); random r = new random(); string randomnoun = nouns.get(r.nextint(0, nouns.length));

browser - How do custom link prefixes work? (like steam://) -

i curious how custom link prefixes work (i have no clue called), , couldn't find anything online it. none. if knows how works, and/or point me in direction of tutorial, me amazing. edit: did find tutorial on doing in ios, need pc/windows app. these prefixes called uri schemes , introduced allow referencing things across applications. thus, these prefixes first part of uniform resource identifier . big companies valve in case of steam seem use uri schemes quite excessively, without following rfc 4395 . if plan use such scheme, highly encourage read it, @ least section 2.8 . make sure scheme not collide other well-behaved applications. if in doubt, ask on mailing list. for technical implementation, how implement support uri scheme heavily application-dependent. steam, instance, uses schema through os-level handlers things starting games or controlling steam client through browser. uris somehow reference locally installed steam client. http , different example,

Best way to determine if a user went offline in MySQL -

so script forces user send "ping" every 10 minutes. inserts record mysql user id , current timestamp. what achieve seeing if of users went offline recently. in theory selecting online (20ish minutes ago) user, checking if there has not been ping in past 11 minutes except don't seem able figure out how. have far: select * status time > (curtime() - 1200) , time < (curtime() - 660) i have add, in combination php shouldn't matter. any appreciated. i try : select timediff(curtime(), max(s.time)) duration, s.user status s group s.user having duration > 660 , duration < 1200; if username not stored in status table. should perform join between status , user. you can use between statement if want check duration specific range too. edit : madbreaks "recently" constraint. can add , duration < xxxx not retrieve old durations , keep "recent" status in result set.

java - Determining whether string is a proper noun in text -

i'm trying parse text ( http://pastebin.com/raw.php?i=0wd91r2i ) , retrieve words , number of occurrences. however, must not include proper nouns within final output. i'm not quite sure how accomplish task. my attempt @ this public class textanalysis { public static void main(string[] args) { arraylist<word> words = new arraylist<word>(); //instantiate array list of object word try { int linecount = 0; int wordcount = 0; int specialword = 0; url reader = new url("http://pastebin.com/raw.php?i=0wd91r2i"); scanner in = new scanner(reader.openstream()); while(in.hasnextline()) //while parse text { linecount++; string textinfo[] = in.nextline().replaceall("[^a-za-z ]", "").split("\\s+"); //use regex replace punctuation empty char , split words white space chars in between

playframework - Implementing spring-websockets in play 1.2x -

i overhauling websocket functionality of play app, , have application layer protocol stomp @ disposal. have embarked down path of bringing spring-websockets mix, having trouble connecting routing incoming requests message handlers. section 21.2.1 of this docuemnt indicated that: the above use in spring mvc applications , should included in configuration of dispatcherservlet. however, spring’s websocket support not depend on spring mvc. relatively simple integrate websockethandler other http serving environments of websockethttprequesthandler. i have been looking examples of application has utilized websockethttprequesthandler in way, , have yet find it. if point me in right direction awesome! thanks, jeremy to update on this, after 2 weeks of trying integration work out threw in towel. heart of our issue seemed inability map play's request object spring recognize. because of not able handshake negotiated. some things did not try may yeild something:

java - Internal inconsistency detected during lambda shape analysis -

in similar problem described in this unanswered question , this other unanswered question , receive warning in eclipse luna service release 1 (4.4.1) (20140925-1800) reading, "(recovered) internal inconsistency detected during lambda shape analysis". code follows: public static <t> t findfirst(iterable<t> list, predicate<t> condition) { /* ... */ } public static integer findfirstprime(iterable<integer> integers) { return findfirst(integers, integer -> { /* return either true or false */ } ); } the warning raised on text reading integer -> . there bug report stating issue fixed eclipse mars 4.5, can in meantime? if want use @suppresswarnings , how know warning type supply? unfortunately, not type of warning can suppress. at least looks fix has been back-ported 4.4.2 maintenance release of luna, due released on february 27, 2015: https://projects.eclipse.org/projects/eclip

java - SQLite create dynamic table (or view?) -

i have 3 tables: table.keys, table.tags, table.values table.keys create table statement: createtablestatement = "create table " + tables.keys + "(" + keyscolumns._id + " integer primary key autoincrement," + keyscolumns.key + " text not null," + "unique (" + keyscolumns.key + ") on conflict ignore" + ");"; execsql(sqlitedatabase, createtablestatement); table.tags create table statement: createtablestatement = "create table " + tables.tags + " (" + tagscolumns._id + " integer primary key autoincrement," + tagscolumns.name + " text not null," + "unique (" + tagscolumns.name + ") on conflict ignore" + ");"; execsql(sqlitedatabase, createtablestatement); table.value create table

r - ggplot2: can a non-aesthetic parameter vary by factor? -

Image
i want create ggplot in statistical parameter varies according aesthetically mapped factor. specifically, i'd create contour plot using stat_density2d(), i'd to map discrete factor color, , i'd specify different break values each factor level. here's minimal working example: d <- data.frame(x=c(rnorm(500), rnorm(500, 2)), y=rnorm(1000), z=c(rep("a", 500), rep("b", 500))) ggplot(d, aes(x, y, fill=z)) + stat_density2d(breaks=.05, geom="polygon", alpha=.5) this i'm going except breaks identical across factors. i'm looking way specify different break values each factor. 1 way create separate layer each factor: ggplot() + stat_density2d(data=d[d$z=="a",], aes(x, y), breaks=.05, geom="polygon", alpha=.5, fill="red") + stat_density2d(data=d[d$z=="b",], aes(x, y), breaks=.1, geom="polygon", alpha=.5, fill="blue") but isn't workable beca

c++ cli - Difference between "struct" and "value struct" -

what difference between public struct x{ public: int a;}; and public value struct x{ public: int a;}; how can convert 1 other? the first normal c++ structure. using value struct creates c++/cli value type (a .net structure). typically want copy 1 other manually, though if memory layout same, can use things marshal::ptrtostructure copy data directly. note returns boxed value struct , however, manual copying more efficient.

html - Webpage 410 Gone htaccess -

my website had been hacked , lots of pages had been added , these have been indexed google. has affected amount of traffic site receiving. these pages all named along lines of - '?mulberry-948.html' different number each. i have deleted these pages there links these lots of websites around web google still looking them. is possible set of these pages gone (410) using .htacess in simple way without having add each file (over 10000 files). i.e can begins '?mulberry' set gone? thanks if ?mulberry after page name, can with: rewriteengine on rewritecond %{query_string} mulberry [nc] rewriterule ^ - [g,l] if it's in url (without ? ) can use: rewriteengine on rewriterule mulberry - [nc,g,l] you can use both, if not use word mulberry site.

php - I cannot pull out $_SESSION values from a named session -

i have named session can call using this print_r($_session['sessionname']); it returns following out of session variable. myclass object ( [mycolumn] => myvalue64 [mycolumn2] => 47 [mycolumn3] => 19 ) however when try echo mycolumn this. doesn't display value. echo $_session['myclass']['mycolumn']; i'm on php 5.3.3 if helps. thanks have tried: echo $_session->mycolumn or in case echo $_session['sessionname']->mycolumn

sockets - Compiler error when using AlwaysRightInstitute/SwiftSockets -

Image
i'm try write small game on ios using socket , i've had java socket server running flash client, got complier errors when add alwaysrightinstitute/swiftsockets source code swift project, , did nothing after doing this here project structure: the selected group "arisockets" source code drag project and here errors(use of unresolved identifier 'ari_fcntivi'): it seems errors cause lack of import file , found "ari_fcntivi" in arisockets/unixbridge.c,but i'm newer swift/objective-c/c (i'm as3 developer), sucks me :/ i had same problem library. need create bridge file similar "import objective-c swift" c: how call objective-c code swift

c - How is line break handled under Windows and why it affect text rendering in some editor -

Image
i copied excerpt pdf , paste on sublime text. excerpt came line break: i wrote small c program remove line break. #include <stdio.h> #include <stdlib.h> #include <assert.h> int main(){ file* in = fopen("feynman.txt","r"); file* out = fopen("feynmanstripped.txt","w"); assert(in!=null && out!=null); int c; c = fgetc(in); while(c!=eof){ if(c!='\n') fputc(c,out); c = fgetc(in); } } the program executed under cygwin. the resulting text opened in sublime text , notepad: as can see, line break disappear in notepad, not in sublime text. tried read/write "rb" / "wb" mode, didn't make difference. i guess might due how windows deals '\n' , '\r' , affects how sublime text , notepad render text. working under hood? ( note : copy/paste same text ms word, result same in st ) interesting. yes,

xcode - Refer to files under Resources folder of a framework -

i integrating framework project. however, having troubles in referring files under resources folder. the code should be: nsstring *frameworkpath = @"someframework.framework/resources/abc"; nsstring *filepath = [[nsbundle mainbundle] pathforresource:frameworkpath oftype:@"json"]; // nil !!! // load file nsdata object called jsondata nserror *error = nil; nsdata *jsondata = [nsdata datawithcontentsoffile:filepath options:nsdatareadingmappedifsafe error:&error]; // crashed here !!! since cannot refer abc.json under someframework.framework/resources folder, filepath nil , leading app crashed @ jsondata : *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[_nsplaceholderdata initwithcontentsoffile:options:error:]: nil file argument' *** first throw call stack: (0x2435c49f 0x31b52c8b 0x2435c3e5 0x24fc3f3b 0x24fc3ecd 0x345fd 0x323e9 0x32021 0x27307 0x20d99 0x1a19b 0x24036369 0x240363b9 0x240364fd 0

java - the trustAnchors parameter must be non-empty error while downloading Android SDK Build Tools 19.1 -

i upgraded android studio 1.0rc4. 1 of android projects used older buildtoolversion android studio suggested upgrade 19.1.0 while downloading android studio following errors: loading sdk information... refresh sources: failed fetch url https://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: java.lang.runtimeexception: unexpected error: java.security.invalidalgorithmparameterexception: trustanchors parameter must non-empty fetched add-ons list refresh sources failed fetch url https://dl-ssl.google.com/android/repository/repository-10.xml, reason: ssl java.lang.runtimeexception: unexpected error: java.security.invalidalgorithmparameterexception: trustanchors parameter must non-empty refresh sources: failed fetch url https://dl-ssl.google.com/android/repository/repository-10.xml, reason: ssl java.lang.runtimeexception: unexpected error: java.security.invalidalgorithmparameterexception: trustanchors parameter must non-empty there nothing install or update

Python using *args with default argument -

python newb here. suppose have function def myfunc(a = "apple", *args): print(a) b in args: print(b + "!") how pass set of unnamed arguments *args without altering default argument? what want is myfunc(,"banana", "orange") and output apple banana! orange! but doesn't work. (i'm sure has been discussed before searching came empty) in python 3 can changing a keyword argument : >>> def myfunc(*args, a="apple"): print(a) b in args: print(b + "!") ... >>> myfunc("banana", "orange") apple banana! orange! >>> myfunc("banana", "orange", a="watermelon") watermelon banana! orange! in python 2 you'll have this: >>> def myfunc(*args, **kwargs): = kwargs.pop('a', 'apple') print b in args: print b + &qu

ios - Azure Mobile Service Api custom call returning empty byte array -

i have mobile service custom controller returning rows db xml. calling localhost:xxx/api/getsomrows returns data, part ok. [self.client invokeapi:@"getsomerows" body:nil httpmethod:@"get" parameters:@{@"id":item} // sent query-string parameters headers:nil completion:^(nsdata *result, nsurlresponse *response, nserror *error) { nslog(@"result: %d", [result count]); }]; returning single int or string value works using "id result" return type, when im returning 2 or more objects byte array right number of rows without data totally empty. ive tried result type nsdata* , nsobject, nsstring turn out empty. any ideas?

cryptography - Big List Python for Charm-Crypto group element -

while working charm-crypto package, need lots , lots of group element exponentiation. group elements come bi-linear pairing group. order of group element 1024 bit integer. reduce average cost of exponentiation, wanted use memoization. but came know list not support long indices (which need much). went dictionary taking lot of time & space. could suggest other methods/data structure in python reduce exponentiation cost. using iterative square-multiply technique exponentiation.

Ruby roo gem: comparison of Fixnum with nil failed (ArgumentError) -

for xls reading using 'roo' gem, time getting error. rails 4 gem roo (1.13.2) require 'roo' class helptextmigration def self.data_do roo::excel.new("/home/kanna/files/article.xls").each |line| puts "---------{line}----------" end end error: /home/kannan/.rvm/gems/ruby-2.1.2@rails4-cms-development/gems/roo-1.13.2/lib/roo/base.rb:427:in `>': comparison of fixnum nil failed (argumenterror) in console 2.1.2 :131 > roo::excel.new("/home/kanna/files/article.xls").first_row => nil from looking @ code if seems first_row return nil if default sheet (or first sheet, if did not assign default sheet) not have non-empty lines. check file see if maybe empty, or if first sheet empty.

Access database functions -

i created database @ work on access 2010 queries using left() , right() , mid() functions. copied database on pc @ home, these functions not want work on database. pc @ home has access 2010. everytime try run query following message, there error compiling function. visual basic contains syntax error. check code , compile again. i created new db on pc @ home test functions , had no problems. noticed on pc @ home heading reads database1 : database(access 2007) - microsoft access while @ work says database1 : database(access 2007 - 2010) - microsoft access . both pcs have windows 7 professional , home pc 1 year old , pc @ work 3 months. updated/repaired access @ home, db still not want work. how can fix problem? i have simple table call table1 id column , column named name , id name 1 jason 2 casey 3 shasha now if want use left() function in access query , error message: there error compiling function. visual basic contains syntax error. check code , compile again.

Is it a good practise to create a seperate java file for each class in Eclipse? -

Image
when create new class using above menu ,a new java file created each class , can see leads lot of .java files quickly(why ellipse show .class structure inside .java file, ) , design practice considering fact want classes small such as class name { string firstname; string lastname; } i'm new eclipse , java ide's , can tell me shortcut create new class . it not practice, way java intended written. why each public class in separate file? multiple classes in same file possible, nested classes , anonymous classes , on, should have reason such thing. there nothing wrong small class, , improves readability when not searching through large files looking internal classes.

angularjs - Calling a function from a link on Kendo Grid column -

i using angularjs , kendo grid together. have 3 files: html (containing view displayed), controller(coordinate between view , model), service(business logic). have kendo grid , button on view. want button show/hide on click of link on column of kendo grid. below code snippet. html <div ng-app="myapp"> <div ng-controller="myctrl"> <div id="grid" kendo-grid k-options="kendogrid"></div> <input type="button" id="mybutton" ng-show="showbutton"/> </div> </div> service: var myapp = angular.module('myapp',[]); myapp.service('myservice', function () { this.showme = false; this.changeshow = function(){ this.showme = !this.showme; }; this.getkgrid = function () { var kgrid = { datasource: [{"col1":"val1","col2":"val

javascript - Text of textbox doesn’t update in submit button click -

i have 2 radiobutton. if 1 of them checked textbox active , data. in update page. in page-load fill them data database , check ispostback. if textbox have text in page load, text change , work fine if haven’t text in first place, keep default text , doesn’t update in submit button click. string val = "0"; if (radiobutton2.checked && textbox1.text.length != 0) val = textbox1.text; in page load use code initialize radiobuttons: t.readonly = true; t.backcolor = system.drawing.color.gray; and there's javascript code active , inactive textbox function checkedchanged(rbtnelement, txtelement) { if (document.getelementbyid(rbtnelement).checked) { document.getelementbyid(txtelement).readonly = false; document.getelementbyid(txtelement).style.backgroundcolor = "white"; } else { document.ge