Posts

Showing posts from September, 2014

Toggle doesn't work - java -

i trying toggle value of key1 in same value time. doing wrong here? boolean jsontext = true; jsonobject jsonobj = new jsonobject(); public void setjsonobject(boolean val){ this.jsontext = val; } public boolean getjsonobject(){ return this.jsontext; } @post("/hello") @permitall public string hello(string text) { try { if (jsonobj.has("key1")) { boolean val = !jsonobj.getboolean("key1"); jsonobj.remove("key1"); jsonobj.put("key1", val); } else { jsonobj.put("key1", true); } } catch (jsonexception e) { e.printstacktrace(); } return "some result"; } am resetting " key1 " boolean value somewhere? you creating new json object every time: jsonobject jsonobj = new jsonobject(); so never has value "key1" , set true after hello code.

objective c - iOS UItableView remove object from array by index path -

i have custom contact book sorted a-z sections. trying add array selected contacts - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsmutabledictionary *contactinfo = [nsmutabledictionary new]; cell *cell = (cell *)[self.conttableview cellforrowatindexpath:indexpath]; //nslog(@"cell %@", cell.contact.fullname); if (!cell.contact.contactchecked) { cell.contactimage.image = [uiimage imagenamed:@"cell_blue_circle.png"]; cell.contact.contactchecked = yes; //nslog(@"did select %@", cell.contact.fullname); nslog(@"index checked row %d section %d", indexpath.row, indexpath.section); [contactinfo setvalue:cell.contact.fullname forkey:@"name"]; [contactinfo setvalue:cell.contact.numbers.firstobject forkey:@"phone"]; [self.seletedpeople insertobject:contactinfo atindex:indexpath.row]; } else { nslog(@"index unchecked row %d section %d",

c# - Conditional Grouping in RDLC -

i able conditionally group item in rdlc, i'd option not group anything. i'm not sure on how that. here's current group expression: <group name="groupby"> <groupexpressions> <groupexpression>=iif(parameters!groupby.value = "c", fields!city.value, fields!state.value)</groupexpression> </groupexpressions> </group> i have 3 group options i'd like: if value "c", group city if value "s", group state if value "n", don't group anything just add statement , if doesn't = c or s group unique id value. =iif(parameters!groupby.value = "c", fields!city.value, iif(parameters!groupby.value = "s", fields!state.value, fields!someuniquevalueuniquetoallrecords.value)) hope helps.

c# - Detect when paste event ocured in whole system -

i need detect when paste in whole system. example in notepad or word not in c# application. examples find describe winforms application. when able detect event modify pasted value. thanks to achieve asking, have inject application in other windows running on system. process called hook. excerpt how set windows hook in visual c# .net global hooks not supported in .net framework except wh_keyboard_ll low-level hook , wh_mouse_ll low-level hook, cannot implement global hooks in microsoft .net framework. install global hook, hook must have native dll export inject in process requires valid, consistent function call into. behavior requires dll export. .net framework not support dll exports. managed code has no concept of consistent value function pointer because these function pointers proxies built dynamically. low-level hook procedures called on thread installed hook. low-level hooks not require hook procedure implemented in dll. what hooks : a hook po

MySQL 5.5 Alter Table TimeStamp default to Current Value, but it's being set to 0 instead -

i trying add last_updated column table w/ preexisting data in it. after execute alter table statement, expect last_updated column existing data set current_timestamp . alter table tablename add column last_updated timestamp not null default current_timestamp on update current_timestamp however, value set 0000-00-00 00:00:00 preexisting rows. subsequent inserts created current_timestamp expected. i using mysql 5.5. expectations incorrect here? or doing wrong? well, old bug bug #68040: alter table add column timestamp default current_timestamp still inserts zero , solved version 5.6.11 changes in mysql 5.6.11 (04/18/2013) . in 5.5, 13.5 sql syntax prepared statements can avoid problem more code. example: set @`ddl` := concat('alter table `tablename` add column `last_updated` timestamp not null default \'', current_timestamp(), '\' on update current_timestamp;'); prepare `stmt

uitableview - xcode 6: puzzling tableview cell constraints -

my app has number of tableviews. each cell has textview , switch. cannot constraints behave consistently. in many cases height of table view cell 98 , height of textview 90 , y=8. if attempt update constraints, wants set both bottom , top spaces 8 , other times not. wants adjust height of textview. have been unable see pattern. set cell height text height + 8. frustrating because want of text views align consistently. doing wrong? or bug? try set 4 constraints textview top space bottom space leading space (left) all 3 parent view (the cell) , height constraint

haskell - Setting begin and end of multi-line input in Parsec -

i new @ parsec . appreciate pointers problem here. say, have csv file fixed number of headers. instead of parsing each line separately, token @ beginning of line, , lines until next line non-empty token. example below: token,flag,values a,1, ,,a ,,f b,2, rule valid input is: if token field filled in, lines until next non-empty token field. so, parsec multiple lines below first input (those multiple lines can parsed rule): a,1, ,,a ,,f then, process starts again on next line non-empty token field (last line in example here). trying figure out if there simple way specify rule in parsec - lines meet rule. handed off parser. basically, looks kind of lookahead rule specify valid multi-line input. did right? we can ignore comma separator above now, , input begins when character found @ beginning of line, , ends when character found @ beginning of line. i solved problem of @user2407038 suggested basic outline in comment. solution , explanation below (please see comme

mysql - Limit rows in SQL for each group with Joins -

i trying limit rows each group of output. way it. explaining case below: table1: customer_details customer id vandeur pid_01 vandeur pid_02 vandeur pid_03 vandeur pid_04 vandeur pid_01 vandeur pid_02 vandeur pid_03 vandeur pid_04 vandeur pid_05 table2: month_details month id jan pid_01 jan pid_02 jan pid_03 jan pid_04 feb pid_01 feb pid_02 feb pid_03 feb pid_04 feb pid_05 my output requirement - want first 3 ids of each month customer vandeur sample o/p: customer month id vandeur jan pid_01 vandeur jan pid_02 vandeur jan pid_03 vandeur feb pid_01 vandeur feb pid_02 vandeur feb pid_03 can suggest me ways achieve it. mysql doesn't support window functions other rdbms,to n results per group can use user defined variables select distinct c.customer,m1.

How to make simple connection to facebook in C#? -

i have windows aplication form. i need somehow connect facebook account and... return name , surname (write value label). enough. i found several information hot on asp.net or mvc, simple application? don't know if still need it, find there basic connecting / extracting application. this documentation facebook sdk c#.

java - Android Studio 1.1.0 You need to use a Theme.AppCompat theme (or descendent) crush -

using: android studio 1.1.0 api 21 (android 5.0.1) crush exception: 04-09 19:06:59.089 1892-1892/com.example.abrate.myapplication e/androidruntime﹕ fatal exception: main process: com.example.abrate.myapplication, pid: 1892 java.lang.runtimeexception: unable start activity componentinfo{com.example.abrate.myapplication/com.example.abrate.myapplication.mainactivity}: java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity. @ android.app.activitythread.performlaunchactivity(activitythread.java:2298) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2360) @ android.app.activitythread.access$800(activitythread.java:144) @ android.app.activitythread$h.handlemessage(activitythread.java:1278) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5221) @ java.lang.reflect.m

xml - Extra content at end of document -

i keep getting parsing error: content @ end of document cannot figure out. thought due not having root tag there. weather feed. <!--?xml version="1.0" encoding="iso-8859-1"?--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <xsl:output method="html" indent="yes" /> <xsl:template match="/"> <xsl:variable name="scale" select="rss/channel/yweather:units/@temperature"/> <table width="100%" border="0" cellspacing="0" cellpadding="3" class="normal"> <tr bgcolor="#075c70"> <td colspan="2"> <strong> <font co

Angularjs directive watching binded attribues -

i need create simple directive show value if value change. example watch 'event' , if event.eventduration === 'now' have change it's value 'surprise!'. with code see valid event in console once. if changes {{event.eventduration}} changes, not directive. did wrong? in html code used have this: <event-time event="event"></event-time>{{event.eventduration}} this custom directive: angular.module('my-app').directive('eventtime', function ($c, $compile) { var linker = function(scope, element, attrs) { scope.$watch('event', function(newvalue){ if (newvalue !== undefined && newvalue.eventduration !== undefined) { scope.value = newvalue.eventduration; element.html(scope.value); $compile(element.contents())(scope); } }); }; return { restrict: 'e', template: '{{value}}

delegates - Unscoped delegation in Rails -

class donateditem belongs_to :donation_item delegate :name, to: :donation_item, prefix: true end i'm using destroyed_at gem donationitem , i'm running error when call donated_item.donation_item_name on destroyed donationitem. what's way make unscoped delegate call destroyed donationitem? i ended using unscoped_associations gem , updated donateditem model. class donateditem belongs_to: :donation_item, unscoped: true delegate :name, to: :donation_item, prefix: true end

c# - How do I calculate a checksum on all columns in a row using LINQ and Entity Framework? -

the query trying execute similar this: var checksum = in db.items i.id == id select sqlfunctions.checksum("*"); however, returns checksum value of string "*" rather evaluating wildcard. there way calculate checksum of columns instead? update: var checksum = db.database.sqlquery<int?>("select checksum(*) [catalog].[item] id = @p0", id); this gives me result want seems dirty. there way without inline sql? this can done sqlfunctions class. class allows linq-to-entities code include methods converted sql. first of in current edit: using inline sql not 'dirty' , totally fine in (if not all) cases. orms don't provide everything, if there isn't object-column mapping exists. however, since you're using entity framework might aquanted sqlfunctions static methods. in case there lot of overloads performing checksum, must of same type. since didn't post types columns or how many have, don't

Android Studio how to use ActionBarScherlock -

hello everyone, i'm trying create project using actionbarscherlock time experience problems. i looking answers @ stackoverflow still problems persist. create projects library; i'm trying import modules etc. still, got problems this: error:the sdk build tools revision (17.0.0) low project ':actionbarsherlock'. minimum required 19.1.0. what want step-by-step instruction how import library work properly. in build.gradle: android { compilesdkversion 21 buildtoolsversion "21.1.2" dependencies { compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' } make sure android studio date. go android sdk manager , download android sdk tools rev. 24.1.2 , android sdk platform-tools rev. 22

linux - Symbols, ELF and How To Link in Memory -

as far understand it, elf format names external symbols linked linker. want loading unlinked elf , link in memory , dynamically. can explain me necessary details how linking down , changes in memory? [update] to clarify , defend question being broad again here more information. i understand jump addresses , can obtain jump addresses in memory functions using c. loading c program addresses. the parameter passing known , hard wired there nothing it. within asm or c o-file (elf-format) find symbol table should related problem not know in op codes have adapt , how. and please not tell me read gnu libc stuff. not problem face. neither want dig format nor want fiddle down op code parsing stuff. so how symbol table handled in memory , expressed? should simple answer knows how done. elf divided sections onto disk, segments in memory. basically loading process means doing section segments mapping, , process fixups. (including global tables got) by symbol loadin

WinApi C multithreading: how to wait for a thread to finish? -

i'm writing multithreaded program calculate fibonacci, power , factorial. instead of using sleep , wait threads finish, , i'd display ids of threads in order finish (first finished, first displayed). how should this? #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> unsigned int n = 0; int priorytety[3] = { thread_priority_below_normal,thread_priority_normal, thread_priority_above_normal}; handle watki[3]; dword winapi fibbonaci(void *argumenty){ unsigned long long int prevprev = 0; unsigned long long int prev = 1; unsigned long long int wynik = 1; while (wynik <= n){ wynik = prev + prevprev; prevprev = prev; prev = wynik; } printf("fibbonaci : %llu \n", wynik); exitthread(wynik); //return wynik; } dword winapi potegi(void *argumenty){ unsigned long long int wynik = 2; while (wynik <= n){ wynik = wynik << 1;

java - How are timeouts set for AndroidAsync websockets? -

i trying change default androidasync websocket initial connection timeout of 30 seconds. working version default timeout: asynchttpclient.getdefaultinstance().websocket(connectionuri.tostring(), null, this); i change timeout. expected work: int timeout_ms = 20000; asynchttpget request = new asynchttpget(connectionuri.tostring()); request.settimeout(timeout_ms); asynchttpclient.getdefaultinstance().websocket(request, null, this); this results in java.lang.illegalargumentexception: invalid uri=ws://exampleserver.com:80/test middlewares=[com.koushikdutta.async.http.httptransportmiddleware@1e2543c8, com.koushikdutta.async.http.spdy.spdymiddleware@2534fc61, com.koushikdutta.async.http.asyncsocketmiddleware@107b3386] note same connectionuri string successful in first case, not second. is there way change timeout of androidasync websocket? this hack helped me.you need pass http or htpps protocol. asynchttpget request = new asynchttpget("ws://xxx.xxx.x.xx:85

c++ - malloc issue with struct of containing an array of strings -

i've read other posts issue. when change top line: typedef char key_type; to typedef string key_type; i memory access error @ p->key[1] = x; typedef char key_type; // change string , breaks typedef struct node_tag{ int count; key_type key[maxsize + 1]; struct node_tag *branch[maxsize + 1]; }node_type; node_type *insert(key_type newkey, node_type *root) { key_type x; /* node reinserted new root */ node_type *xr; /* subtree on right of x */ node_type *p; /* pointer temporary use */ bool pushup; /* has height of tree increased? */ pushup = pushdown(newkey, root, &x, &xr); if (pushup) { /* tree grows in height.*/ /* make new root: */ p = (node_type *)malloc(sizeof(node_type)); p->count = 1; p->key[1] = x; // memory access error p->branch[0] = root; p->branch[1] = xr; return p; } return root; } what small modification can made

html - How can I keep the bottom contents of a webpage static when under a dynamic table? -

i working on custom pagination leads "last page" having less max number of rows. keep webpage static when table drops or of rows. i.e. scrollbar should keep same length. to rebuild contents of pagination table, using ajax call in struts 1.x pull jsonarray , information used build raw html data replace existing: $('#resultsdisplay tbody').remove(); $('#resultsdisplay').append(tbodyhtml); i've played around rows can built in place of missing data, when hidden doesn't seem work expected. a simple way wrap table in container div , give min-height . can't directly table because causes stretch, don't want. here's example: div { min-height: 20em; background: #ddd; } above <div> <table> <tr> <td>i'm</td> <td>a</td> </tr> <tr> <td>kewl</td> <td>table</td> </tr> </table&g

How to write Privacy Policy for iOS Application which uses the Health App -

hi i'm making ios application uses health app , submit application in app store have provide privacy policy, don't know write inside because i'm not usa , english not well... in healthkit framework reference it's said: you must provide privacy policy app uses healthkit framework. can find guidance on creating privacy policy @ following sites: personal health record model (for non-hipaa apps): http://www.healthit.gov/policy-researchers-implementers/personal-health-record-phr-model-privacy-notice hipaa model (for hipaa covered apps): http://www.hhs.gov/ocr/privacy/hipaa/modelnotices.html my application writes calories, proteins , sugars in health app, don't know hippa , non-hipaa what's difference? , can give me exaple privacy policy ? hipaa law in united states contains provisions regulate identifiable health information. created prevent entities deal medical records being careless , letting patient records stolen or misused. here lin

jquery mobile - Javascript change icon -

i try change icon select element. have made 2 values, need 3. any idea wrong code? var icon = document.getelementbyid.("marker-icon"); if (type == 1) { marker-icon.src = "images/icon1.png"; } else if (type == 2) { marker-icon.src = "images/icon2.png"; } else if (type == 3) { marker-icon.src = "images/icon3.png"; } this code 2 values , works fine. var icon = (type == 1) ? "images/icon1.png" : "images/icon2.png"; try this: var icon = document.getelementbyid("marker-icon"); if (type == 1) { icon.src = "images/icon1.png"; } else if (type == 2) { icon.src = "images/icon2.png"; } else if (type == 3) { icon.src = "images/icon3.png"; } there . after getelementbyid , using marker-icon instead of icon . (i assuming marker-icon id of img tag.)

Populating a treeview with files in ASP.NET C# -

Image
i have treeview trying populate folders , files. treeview populating folders fine not files. here code: protected void page_load(object sender, eventargs e) { if (!ispostback) { populatetree(); } } private void populatetree() { //populate tree based on subfolders of specified virtualimageroot var rootfolder = new directoryinfo(virtualimageroot); var root = addnodeanddescendents(rootfolder, null); //add root treeview treeview1.nodes.add(root); } private treenode addnodeanddescendents(directoryinfo folder, treenode parentnode) { //add treenode, displaying folder's name , storing full path folder value... string virtualfolderpath; if (parentnode == null) { virtualfolderpath = virtualimageroot; } else {

c# - Creating complex xml strucure -

i c# developer 1-year experience. facing issue creating complex xml request web service. i have received xsd file & sample xml requests. i've populate correct data , call web service. 've little experience in creating small xml structures. doing using string concatination /xml document object / xml writer . methodsare small structures bigger structure it's not easy write each , every tags using above object models. please let me know best way of creating complex xml structures c# . thanks. linq xml succinct way express xml linq queries. here how can build xml tree in linq xml (from microsoft: https://msdn.microsoft.com/en-us/library/bb387089.aspx ). xelement contacts = new xelement("contacts", new xelement("contact", new xelement("name", "patrick hines"), new xelement("phone", "206-555-0144"), new xelement("address", new xelement("str

java - Get text from textField (from Jframe1) and change label text in Jframe2 -

i'm developing game , stuck on player's name i have jframe gamewindow , there label labelplayername . need change text in label text textbox jframe named enteryourname . gamewindow , enteryourname 2 separate classes in 1 folder (btw i'm using eclipse) i create get/set methods in files call change text. once should able name.settext(userinput.gettext());

java - Shifting in arrayList -

the method public static <t> arraylist<t> rotate(arraylist<t> al, int shift) accepts arraylist of string (at least in example) , shift indicated how arraylist should shift. if have, let's araylist of [ a, b, c, d, e, f, g] and shift 2 , method returns [ f, a, b, c, d, e] or example, [ a, b, c, d, e, f, g] and shift 4 , method returns [ d, e, f, g, a, b, c] i did method wrong , have no clue how approach problem. smb me ? import java.util.arraylist; public class rotation{ // demonstrate rotat(a,shift) method public static void main(string arg[]){ arraylist<character> charsl; charsl = new arraylist<character>(); char [] chars = { 'a', 'b', 'c', 'd', 'e', 'f'}; for(char c : chars){ charsl.add(c); } // charsl = [ a, b, c, d, e, f] arraylist<character> result1; result1 = rotate(charsl, 2); // result1== [ e,

javascript - Which way to create a canvas pattern from a dataToURL-image string as directly as possible? -

Image
i'm using image had made by var patternimageasdataurl= canvasobject.todataurl('image/png'); in later stage want make canvas pattern object. following code doesn't work - assume image not loaded when going last line, needed in createpattern function. var img = document.createelement('img'); img.src = patternimageasdataurl; // canvasctx created somewhere else in program pattern = canvasctx.createpattern(img,'repeat'); i error: ns_error_not_available: on last line. (and when using console.log on width , heigth of img between 2 last lines, see when it's not working dimensions 0 .) when later on same operation done same dataurl, work. though image (img) should created anew. (only reason can see it's because of internal optimization in firefox. that's offtopic here, unless know answer.) width , height when printing them out console correct then. while quite program pattern handling service, should solve this, question in general ,

Accessing weight data via the Google Fit REST API -

for last 6 months i've been entering weight google fit, want data out. accessing google fit rest api hasn't been issue. finding weight data amongst accessable data has stumped me however. any pointers greatfully appreciated. i can weight data found api request weight data https://www.googleapis.com/fitness/v1/users/me/datasources/derived:com.google.weight:com.google.android.gms:merge_weight/datasets/0-1443194884000000000 last set start time , end time. let me know if have issue weight data. may query you.

Latex (texmaker) table \cline -

Image
i'm having problem creating table in latex. so want create table when use \cline gives me error ! paragraph ended before \@cline complete.\par and more. i'm using \usepackage{multiraw} , \usepackage{tabulary} tables. the table: \begin{table} \centering \begin{tabular}{|c|c|c|c|c|c|c|} \hline \multirow{2}{*}{laktóza $ [\mathrm{mmol \cdot dm^{-3}}] $} & \multirow{2}{*}{} & \multicolumn{5}{c|}{onpg $ [\mathrm{mmol \cdot dm^{-3}}] $} \\ \ & & \multicolumn{1}{c|}{0,10} & \multicolumn{1}{c|}{0,25} & \multicolumn{1}{c|}{0,50} & \multicolumn{1}{c|}{1,0} & \multicolumn{1}{c|}{2,0} \\ \ \hline \multirow{2}{*}{0} & $ v_{onpg} \enskip [\mathrm{\mu l}] $ & 10 & 25 & 50 & 100 & 200 \\ \cline{2-7} & $ v_{roztok \enskip z} \enskip [\mathrm{\mu l}] $ & 990 & 975 & 950 & 900 & 800 \\ \ \hline \end{tabular} \end{table} thanks every help. \documentclass{article} \use

javascript - Chain together multiple jQuery animations to progressively animate color -

Image
background i creating progress bar steps animates more steps completed (wizard style after each successive ajax request finishes goes next step). example of i'm going amazon's shipping tracking, pictured below. looked plugins this, couldn't find 1 add in little circle steps image above, creating own jquery. issue & question currently "best" way can think accomplish chaining multiple .animate() methods apply background-color 1 after divs in row. jquery code looks this: $(function () { $(".progress-square:lt(1)").animate({ backgroundcolor: "#fabf03" }, 500, function () { $(".progress-square:lt(2)").animate({ backgroundcolor: "#fabf03" }, 500, function () { $(".progress-square:lt(3)").animate({ backgroundcolor: "#fabf03" }, 500); }); }); }); and html rather simple: <div class="co

c# - How does .NET JIT determine how to add numbers -

cil has single opcode adding numbers without overflow check - add . this c# code: int = 10; int b = 20; int c = + b; produces following il code: il_0000: ldc.i4.s 10 il_0002: stloc.0 il_0003: ldc.i4.s 20 il_0005: stloc.1 il_0006: ldloc.0 il_0007: ldloc.1 il_0008: add il_0009: stloc.2 how jit @ run-time determine, type of x86 addition should use (fpu opcode faddp floats or add integers)? the clr tracks types of values on evaluation stack, knows right before add instruction, types of 2 topmost values on stack int32 in code. means knows has emit instruction adding 32-bit integers. if write code clr won't able figure out types of operands of add , code unverifiable , result in garbage native code.

mysql - Can I sub query this or not? -

i've been trying query/subquery work stats have failed, started again scratch. can results want it's still in 2 separate queries. have little no experience sub queries after reasearching, heart tells me should able in 1 query. info in 1 table need use 2 separate group in order right data. i'm hoping can me head around or @ least point me in right direction... in advance select month(bookadhistory)-1 monthnum, count(distinct bookidhistory) totalbooks, count(distinct case when bookddchistory = 300 bookidhistory end) breaches bookhistory join book on bookid = bookidhistory bookid = 44 group month (bookadhistory) order monthnum; select month(historycreated)-1 monthnum, count(distinct case when bookddchistory between 1 , 99 bookidhistory end) delays, count(distinct case when bookddchistory = 200 bookidhistory end) extns, count(distinct case when bookddchistory = 100 bookidhistory end) lateclose bookhistory join book on bookid =

c++ - Change String Array to tolower -

in program have text file read array tokenizes each word. need way can compare words words found in binary tree. issue is... duplicates of words not formatted same way (one uppercase , 1 lowercase) , need them can found in binary tree. so question is: how change whole array lowercase? here tried far: #include <iostream> #include "binary_searchtree.h" #include "node.h" #include <string> #include <fstream> #include <sstream> using namespace std; const int size = 100; string myarray[size]; int main() { // first constructor used since empty binary_searchtree<string> *tree = new binary_searchtree<string>(); string token, lines; ifstream file("hashtags.txt"); while (getline(file, lines)){ tree -> insertnode(lines); } // convert strings in myarray all-lower myarray = tolower(myarray); // tokenize tweet array search ifstream tweet1("exampletweet.txt&q

Android AppWidgetProvider: How To Interpret Min/Max Width/Height -

i'm attempting create android appwidget 4x1 cells initially, can resized vertically user. created class extends appwidgetprovider, , overrode onappwidgetoptionschanged() method examine appwidgets's minimum , maximum widths , heights whenever user resizes appwidget: @override public void onappwidgetoptionschanged(context context, appwidgetmanager appwidgetmanager, int appwidgetid, bundle newoptions) { int minimumheight = newoptions.getint(appwidgetmanager.option_appwidget_min_height); int maximumheight = newoptions.getint(appwidgetmanager.option_appwidget_max_height); int minimumwidth = newoptions.getint(appwidgetmanager.option_appwidget_min_width); int maximumwidth = newoptions.getint(appwidgetmanager.option_appwidget_max_width); log.d("tag", "minimumheight: " + minimumheight + ", maximumheight: " + maximumheight + ", difference: " + (maximumheight - minimumheight)); log.d("tag", "minimum

java - JMS and MQ (without JNDI) -

created webpage user can paste xml file , after clicking submit option, xml file go other system ( test environment). system running on ibm (mq) , have use jms it. have queue, port, host name. has similar example can use direction? basically, need do: accept xml mesaage ui. create mq connection factory details of port,host , queue. create jms connection mq connection factory. create jms session off jms connection. create jms message producer off jms session. create jms textmessage containing xml file. send message jms queue via producer. will try add code example in while, in meantime each step able find multiple examples online. dont forget close jms message producer, jms session , jms connection in block resources.

unit testing - How to arrange and assert MustBeCalled for property setter in JustMock -

i have mocked class property has , set. code under test calls setter assign connection string value. test code mocks class contains property , add mustbecalled when arrange mock. viewmodel code: public class clientviewmodel { private readonly imgmtdataprovider dataprovider; public clientviewmodel(imgmtdataprovider dataprovider) { this.dataprovider = dataprovider; } private string clientconnectionstring; public string clientconnectionstring { { return clientconnectionstring; } set { clientconnectionstring = value; if (dataprovider != null) dataprovider.clientconnectionstring = value; } } } test code: //arrange const string connectionstring = "this connectionstring"; var mockeddataprovider = mock.create<imgmtdataprovider>(); mock.arrange(() => mockeddataprovider.clientconnectionstring).mustbecalled(); //act var testviewmodel = new c

java - Saving on sql using active android not actually saving -

everyone i've using activeandroid library in android avoid doing sql coding reason isn0t working here code: this manifest: <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> <application android:name=".myapplication" android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme"> <meta-data android:name="aa_db_name" android:value="knownfiles2.db"/> <meta-data android:name="aa_db_version" android:value="5"/> <activity android:name=".mainactivity" android:label="@string/app_name"

r - data.frame without ruining column names -

is there way use data.frame without ruining column names? i have following structure: $`canon powershot` [1] 9.997803e-01 9.997318e-01 3.327920e-01 3.327920e-01 9.988220e-01 [6] 4.030871e-05 4.928497e-05 $`casio exilim` [1] 5.322024e-06 9.999646e-01 5.322024e-06 5.322024e-06 9.999646e-01 [6] 5.322024e-06 9.999646e-01 $finepix [1] 3.850036e-05 9.998887e-01 6.650074e-02 6.650074e-02 9.998465e-01 [6] 9.998465e-01 4.345598e-05 $`kodak easyshare` [1] 3.548812e-05 9.998604e-01 3.996137e-01 3.996137e-01 9.987841e-01 [6] 3.179604e-05 2.789861e-05 $`nikon coolpix series` [1] 9.156401e-02 9.998091e-01 1.995972e-01 1.995972e-01 9.996341e-01 [6] 7.033741e-05 8.499410e-05 but after using do.call(data.frame, my_list) , this: canon.powershot casio.exilim finepix kodak.easyshare 1 9.997803e-01 5.322024e-06 3.850036e-05 3.548812e-05 2 9.997318e-01 9.999646e-01 9.998887e-01 9.998604e-01 3 3.327920e-01 5.322024e-06 6.650074e-02 3.996137e-01 4 3.327920e-01 5.322

How to get original forked repository with the github api? -

i wondering how original repository forked repositories. i using https://api.github.com/users/:user/repos?type=forks list of forked repositories. returns various links on forks, cannot find how original repository. any idea ? note: else looping on https://api.github.com/users/:user/events you can load list of forked repositories using endpoint mentioned: curl https://api.github.com/users/:user/repos?type=forks which return following json feed (irrelevant informations omitted): [ { "id": 24328834, "name": "repo_name", "full_name": ":user/repo_name", "owner": { } ... "url": "https://api.github.com/repos/:user/repo_name", ... } { "id": 24328835, "name": "repo_name_2", "full_name": ":user/repo_name_2", "owner": { ... } ... "url": "https://a

PayPal API transaction final status -

i using paypalapiinterfaceclient (soap service) information transaction (method gettransactiondetails() ) , need absolutely sure transaction status (it means - money has been sent no matter in direction). when transaction completed , when still "on road"? example: assume, processed followed inprogress , changed completed or this. on other hand, denied or - don't know - voided not change in future. can me please decide, status can accepted ultimate (like completed, may completed must not mean final money transfer) , ones still in 1 of sub-state? i expect simple "money transferred" & "money not transferred" result, reality different. shortly, mirror transaction result database , manage automatic transactions (from , client) need know this. i using paymentstatuscodetype enumeration values , service iterates transaction history check if money transferred or not. completed means it's done. may want instant payment notific

c# - How to get the last number in a database column then increment it to include in another record? -

i have been given task of rewriting , old work application classic .asp asp.net includes database table not have auto incremented primary key. want continue use table maintain database integrity (it has 80,000+ records!). problem running need able pull last item id column of database table regardless of how old record is, increment number , include in new record inserted new record's id number. how go doing this? have tried listitem, datareader, datatables, generic lists (as objects), , arraylists. can pull information , store it, cannot last item in collection itself. suggestions appreciated. protected void getprimarykey() { string strsql = ""; try { oledbconnection dbconn = new oledbconnection(); dbconn.connectionstring = system.web.configuration.webconfigurationmanager.connectionstring["connectionstring"].tostring(); strsql = "select observationid observation"; oledbcommand mycmd = new