Posts

Showing posts from August, 2011

javascript - Ember data create record and add incrementProperty/decrementProperty on additional clicks -

i trying create cart type order page in emberjs. this looks http://emberjs.jsbin.com/qanujodo/3#/tickets when clicked on add 1 ticket model saves ticketquantity, , when added 1 more adds model duplicating model records. what want is, when ticketquantity changes update data store record , if same tickettype record present remove records , save current record based on ticketquantity . currently when add 1 adds record data store, , if added more record stored previous records not deleted. should true tickettypes. ideally should pointed out rwjblue in #emberjs irc, ticketcontroller should keep track of order creates , create once, incrementproperty/decrementproperty needed on subsequent cliks on add one/decrease 1 button. how go ? check out: http://jsbin.com/giticexa/3#/tickets didn't touch ui, can see model either created if not present or increment existing model if 1 matches. best of luck!

javascript - How can I pass non-string values to Angular directives? -

i have custom angular directive graphically represents “activity” in webapp. use this: <activity-box ng-repeat="act in activities" model="act" active="{{currentactivity == act}}" /> my directive has isolated scope , declares model , active this: appdirectives.directive('activitybox', function() { return { template: '<div ng-class="{activityactive: active == \'true\'}">{{model.name}}</div>', restrict: 'e', replace: true, scope: { model: '=', active: '@' }, link: ... }; }); i have no worry model attribute, active attribute treated string. when currentactivity == act true, active holds string value "true" (and not boolean true ), or else, "false" (and not false ). this means although conceptually boolean, must treat string. instance, i'd write ng-class=...

jQuery if element is next and has class? -

im using toggle visibility of element: $(".trigger").click(function() { $(this).next().slidetoggle(); }); <p class="triggger">trigger</p> <p class="target">this target</p> its working fun want make next element toggled if has class of target. following isnt working: $(this).next().hasclass("target").slidetoggle(); this trick: $(this).next(".target").slidetoggle(); .slidetoggle() fired on next element if has classname of target only.

servlets - socket timeout in android app from jetty 9 -

my android app sends http request servlet on jetty server , receives response. worked fine in jetty 6.1.26. works fine in jetty 7.6.13( uses servlet-api-2.5.jar) , jetty 8.1.15( uses servlet-api-3.0.jar) when deploy exact same servlet jetty 9.1.5.v20140505(which uses servlet-api-3.1.jar) on same machine, results in socket timeout in android app. use java jre1.7.0_55. in android app, connection timeout 3000 , socket timeout 5000. if increase socket timeout 30,000, makes no difference. if set 40,000 works. any idea what's going on? why android code take time accept servlet response jetty 9? removing response.setcontentlength() in servlet resolved issue. sending 30 characters response, had set length 1024. guess android app expecting more data looking @ length set in response, waits till kind of timeout happens. apparently, servlet 3.1 in jetty 9 behaves differently previous versions.

asp.net mvc 3 - Maintain data in different domains in MVC -

i have small requirement want send data www.example.com , @ same time want data www.example.com . example want search email in www.mydomain.com , if result not found, want search email address in www.otherdomain.com . there want redirect www.mydomain.com , keep data used in email textbox. i know can using query string. there best solution implement requirement?

Best way to get user-defined custom name for an Android device -

what best way user-defined custom name of android device? some phones treat both device name , bluetooth name same. in these cases bluetooth name. in phones there setting called owner info , under security->settings . how can read name that? or there else suggest scenario? understand i'm not asking profile name people app or model / manufacturer of phone. i have posted this answer before: use string ownerinfo = settings.secure.getstring(getcontentresolver(), "lock_screen_owner_info"); make sure catch settingnotfoundexception update as of android 4.4.2 owner info value moved lock screen database, /data/system/locksettings.db , 3rd-party apps have no read/write access. that's, there no reliable way of reading owner info later android versions.

ssl - Using a single certificate for inter-node encryption on Cassandra -

i have inter-node encryption setup on small cassandra cluster (4 nodes), , each node has own key pair. means need distribute trusted keystore nodes contains public key every other node in cluster, makes bit of pain update when add nodes cluster. does cassandra allow using single certificate/key nodes in cluster, or complain? docs see online tell me generate separate key pair each node, not address sharing certificates. if allowed, drawbacks method? adding ca cert truststore of each node sufficient.

Display PNG with raw image data within an html document using PHP -

with code, trying create image of signature json , display image directly in browser without saving it. problem have want display image within html document header information has been modified. there way display image it's raw image data within html document? or other way around issue? $json = $ticket->sig; // json representing signature $img = sigjsontoimage($json); //get image resource json // here want display image cannot modify header information header('content-type: image/png'); imagepng($img, null, 0, png_no_filter); imagedestroy($img); sure, can use 2 things this. the html image tag supports base64 encoded image. can big html, work. can output image buffer using ob_start , ob_end functions. see http://us2.php.net/manual/pt_br/function.ob-start.php so php file can do: $json = $ticket->sig; // json representing signature $img = sigjsontoimage($json); //get image resource json ob_start(); // start buffering output imagepng($img, ...

python - How to use the confusion matrix module in NLTK? -

i followed nltk book in using confusion matrix confusionmatrix looks odd. #empirically exam tagger making mistakes test_tags = [tag sent in brown.sents(categories='editorial') (word, tag) in t2.tag(sent)] gold_tags = [tag (word, tag) in brown.tagged_words(categories='editorial')] print nltk.confusionmatrix(gold_tags, test_tags) can explain how use confusion matrix? firstly, assume got code old nltk 's chapter 05: https://nltk.googlecode.com/svn/trunk/doc/book/ch05.py , particularly you're @ section: http://pastebin.com/ec8ffqlu now, let's @ confusion matrix in nltk , try: from nltk.metrics import confusionmatrix ref = 'det nn vb det jj nn nn in det nn'.split() tagged = 'det vb vb det nn nn nn in det nn'.split() cm = confusionmatrix(ref, tagged) print cm [out]: | d | | e j n v | | t n j n b | ----+-----------+ det |<3>. . . . | in | .<1>. . . | jj | . .<.>1 . | nn | . . ....

asp.net - Incorrect syntax near '-' -

can me code ?! have problems when submit infos, can not add database.this created log-in form add infos , stuff not working can take @ code maybe find bug. $ protected void page_load(object sender, eventargs e) { if(ispostback) { sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings["registerconnectionstring"].connectionstring); conn.open(); string checkuser = "select count(*) userdatat username='" +textboxun.text + "'"; sqlcommand com = new sqlcommand(checkuser, conn); int temp = convert.toint32(com.executescalar().tostring()); if (temp == 1) { response.write("ky user egziston"); } conn.close(); } } protected void button1_click(object sender, eventargs e) { try { sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings["registerconnectionstring"].connection...

streaming - Moving OCR from a PDF to another - Java -

good afternoon , have problem in project, pdf compression , process follows: extract images pdf hang ocr compression stock ocr + merge image , convert pdf per page combine generated pdf ocr, ocr pdfcon 1 out final product. size of original file 11 mb , 4.2 mb compressed . whole process works , problem have speed in ocr process . checking on web, , saw way circumvent process, getting text layer of original pdf , pass final pdf compressed , try codes delete images of pdf , alone text layer , , insert compressed images, problem compared normal process provided above , weight of file increased more 4.2 mb , not convenient me. when seeking solution found handle pdf operators handled pdfbox through pdfstreamparser , pdstream , cosdictionary . operators tj , tw , tz , tc ... etc. . question if knows pass tj operate , 1 contains text of pdf , see if text layer of original pdf can passed final pdf compressed without me 4.2mb high raise weight, idea not spend other operators because these ca...

xml - How can I limit the width of a button within a TableRow in Android? -

Image
i want have buttons take little width necessary. xml in layout file is: <tablerow android:id="@+id/tablerow7" android:paddingleft="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> <button android:layout_width="40dp" android:layout_height="wrap_content" android:text="@string/button_ok" android:layout_column="0" android:id="@+id/buttonok" /> <button android:layout_width="20dp" android:maxwidth="20dp" android:layout_height="wrap_content" android:text="@string/button_cancel" android:layout_column="1" android:id="@+id/buttoncancel" /> </tablerow> i have tried "wrap_content" , "fill_parent" layout_width vals, don't help. can see, tried "maxwid...

html - Trying to put my label above input type text -

i have login form, , im trying put span above input, im not having sucess doing this, tries, im having same result, is: label: [input] but want label: [input] do know trick this? because default seems label aligned left.. this im trying: http://jsfiddle.net/8jkmm/ have html: <div class="loginbox"> <h1>login:</h1> <form name="login" action="" method="post"> <label class="label"> <span class="field">email:</span> <input type="text" name="user" /> </label> <div class="label"> <span class="field">pass:</span> <input type="password" name="pass" class="pass" /> <input type="submit" value="login" class="btn" /> <a href="i...

python - Merge a lot of DataFrames together, without loop and not using concat -

i have >1000 dataframes, each have >20k rows , several columns, need merge common column, idea can illustrated this: data1=pd.dataframe({'name':['a','c','e'], 'value':[1,3,4]}) data2=pd.dataframe({'name':['a','d','e'], 'value':[3,3,4]}) data3=pd.dataframe({'name':['d','e','f'], 'value':[1,3,5]}) data4=pd.dataframe({'name':['d','f','g'], 'value':[0,3,4]}) #some or them may have more or less columns others: #data5=pd.dataframe({'name':['d','f','g'], 'value':[0,3,4], 'score':[1,3,4]}) final_data=data1 i, v in enumerate([data2, data3, data4]): if i==0: final_data=pd.merge(final_data, v, how='outer', left_on='name', right_on='name', suffixes=('_0', '_%s'%(i+1))) #in real case right_on m...

ios - Update Parse Installation objects using REST and only have deviceToken -

when ios users agree receive push notifications on devices, store devicetoken in our backend db. we want use channels send pushes, can't update installation objects device itself, it's not implemented. need , handle subscribe/unsubscribe directly app itself. but, @ possible/doable subscribe/unsubscribe installation object via rest when have devicetoken? the way see pull installation objects parse using master key, traverse devicetoken's find 1 devicetoken need, , use it's corresponding objectid send update call , subscribe/unsubscribe device? is there better way, or "forced" move native app itself? you should able query installation class directly devicetoken , master key via rest , put update. https://parse.com/docs/rest#installations-querying https://parse.com/docs/rest#queries-constraints https://parse.com/docs/rest#installations-updating

c# - Dynamic Controls in PlaceHolder were lost after an action is performed -

i have placeholder in webform master page code <asp:dropdownlist id="noofsubjectlist" runat="server" autopostback="true" onselectedindexchanged="noofsubject_index_changed"> <asp:listitem>1</asp:listitem> <asp:listitem>2</asp:listitem> <asp:listitem>3</asp:listitem> <asp:listitem>4</asp:listitem> <asp:listitem>5</asp:listitem> <asp:listitem>6</asp:listitem> <asp:listitem>7</asp:listitem> <asp:listitem>8</asp:listitem> <asp:listitem>9</asp:listitem> <asp:listitem>10</asp:listitem> <asp:listitem>11</asp:listitem> <asp:listitem>12</asp:listitem> <...

logging - How to register an EventSource etw provider C# and capture the output to a log file.? -

i created "logger" class derives base class eventsource ( event provider ). used instrument application. now, view trace messages logged application use perfview gui tool - first register event provider "*logger" , start collection process through tool. once collection done can view logged events.this works fine, need automate process. when trying automate process faced 2 issues: how register event provider (preferably using c# libraries or microsoft provided cli tools[don't want use third party tools or libraries this.]) how collect logged events etl file using tools logman (or other command line tools). i have provided application source code below (the code basic , straight forward.): using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.diagnostics.tracing; using system.threading; namespace eventlogging { class program {...

Change the color of line in buffer using Vim+Python -

i'm using vim python writing plugin, want know how can change color of line number based on vim.buffers vim module , execute commands specific buffer. skimmed through documentation , tried find methods execute commands specific buffer couldn't find it. any idea how can this? in vim there no 1 solution... think simple solution. function! testing_highlight() highlight mypattern ctermbg=red ctermfg=blue python << eof vim import * myline = 4 eval("matchadd('mypattern', '\%" + str(myline) + "l', 100)") eof endfunction

php - Highlight substring which can contain own extrac characters -

i need create function, highlights searched substring. example, have string "123456789" , search substring "234". it's easy, need create function: str_replace('234', '123456789', '<b>234</b>'); but string can contains 4 (only four) special characters (" ", "(", ")", "-") need jump over. so can have string "12 3(456)78-9)" , still need highlight searched "234", final string needs like "1<b>2 3(4</b>56)78-9)" do have suggestions how this? edit: string , substring can contains character, not numbers example string: "poly(amide 610)" , searched word can "polyamide6" - highlighted "poly(amide 6" you need put subpattern describe characters want skip between each character of target string: $str = '12 3(456)78-9)'; $needle = '234'; $neutral = '[ ()-]*'; $pattern = '/...

c# - Binding an element in a child View to a property of the parent ViewModel -

like title says, bind element in child view property of parent viewmodel. is there caliburn.micro or default wpf xaml syntax this? mean, exact situation: bind parent viewmodel's property. or should try achieve other way? so, best/easiest way it? here basic caliburn.micro app example: mainwindowviewmodel.cs namespace bindingtoparentvmproperty.mvvm { public class mainwindowviewmodel { public childviewmodel child { get; set; } public string parentname { get; set; } public mainwindowviewmodel() { child = new childviewmodel(); parentname = "peter griffin"; } } } mainwindowview.xaml : <usercontrol x:class="bindingtoparentvmproperty.mvvm.mainwindowview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/...

c++ - Qt 5.0.2 and OpenGL 3+ rendering problems -

Image
i have written tiny opengl engine uses 3+ functions. trying integrate engine in qglwidget , have problems. when rendering obj model without qt framework have got expected results, when using qt opengl buffers corrupted in way see wrong result or nothing. without qt: in qglwidget: i want ask whether qt changes opengl states between qglwidget::paintgl() calls. objects initialized , rendered in following order: initialization: create , bind vertex array create , bind vertex buffer fill vertex buffer (works fine - obj loader tested many times) calls glvertexattribpointer() , glenablevertexattribarray() rendering: bind vertex array shaders, uniforms, etc. gldraw*() the issue seeing because qt setting c locale on system you, expecting floats comma delimited instead of period delimited. you can work around resetting local else after invoke qapplication for example: std::setlocale(lc_all, "posix");

c# - GeckoFX - implement search function - how to use nsIWebBrowserFind interface -

could perhaps tell me how should use nsiwebbrowserfind interface in geckofx find strings on webpage? i tried following code, throws me argumentnullexception - parameter cannot null (punk). i have no idea means, have never used interfaces before. geckowebbrowser browser = getcurrentbrowser(); nsiwebbrowserfind finder = browser.getinterface<nsiwebbrowserfind>(); finder.setsearchstringattribute(searchbox1.text); finder.findnext(); i have tried nsiwebbrowserfind finder = gecko.xpcom.getinterface<nsiwebbrowserfind>(browser); with same results:( please help:) thanks! this works in geckofx 29.0: var field = typeof(geckowebbrowser).getfield("webbrowser", bindingflags.instance | bindingflags.nonpublic); nsiwebbrowser browser = (nsiwebbrowser)field.getvalue(webbrowser1); var browserfind = xpcom.queryinterface<nsiwebbrowserfind>(browser); browserfind.setsearchstringattribute(search); try { browserfind...

javascript - How to Read JSON file and Modify JQuery -

i have following code: http://jsfiddle.net/wg2yb/ reads local file (.txt, .json...) , displays content. i want able have not read, modify things. have json file looks bit this: { "height":100, "layers":[ { "data":[0, 0, 0, 0...]; "height":100, ... } } i want know how modify page's jquery based on that. if layers height set 100 in json file, like: $('#map').css('height','100px'); look json.parse turn data more javascript friendly. with can save result javascript object , check properties/array values , manipulate html elements: var data = json.parse(this.result); if (data.layers && data.layers.length && data.layers[0].height) { document.getelementbyid('map').style.height = data.layers[0].height + 'px'; } check out on jsfiddle .

haskell - Could not deduce error when using type constraints -

i using haskell implement linear algebra example. however, run problem when declaring magnitude function. my implementation follows: magnitude :: (foldable t, functor t, floating a) => t -> magnitude = sqrt $ data.foldable.foldr1 (+) $ fmap (^2) the idea magnitude accept vec2d , vec3d , or vec4d , , return square root of sum of squares of components. each of 3 vector types implements functor , foldable . example, newtype vec2d = vec2d (a, a) deriving (eq, show) instance functor vec2d fmap f (vec2d (x, y)) = vec2d (f x, f y) instance foldable vec2d foldr f b (vec2d (x, y)) = f x $ f y b however, receive multitude of errors: linearalgebra.hs:9:13: not deduce (floating (t -> a)) arising use of `sqrt' context (foldable t, functor t, floating a) bound type signature magnitude :: (foldable t, functor t, floating a) => t -> @ linearalgebra.hs:8:14-60 possible fix: add instance declaration (floating (t -...

r - Is this a function shadowing error? -

nothing applicable came in search, ran error when installing package in r: > install.packages("entropy") loading required package: stats attaching package: ‘zoo’ following objects masked ‘package:base’: as.date, as.date.numeric error in eval(expr, envir, enclos) : not find function "data.table" calls: source -> withvisible -> eval -> eval execution halted warning in install.packages : installation of package ‘entropy’ had non-zero exit status now, had data.table loaded in running session. when ran r session root , installed package no new packages loaded, finished no errors, , can load package initial session no problem. where error coming from, , going give me possible bad output if have data.table loaded @ same time? edit: output of conflicts() : > conflicts() [1] "rename" "round_any" "freqs" "show" "plot" [6] "rootogram...

orchardcms - Orchard NHibernate Error: ExecuteReader requires an open and available connection -

i getting nhibernate error in orchard 1.7 after blog gets hit amount of traffic volume: executereader requires open , available connection. connection's current state closed once start getting error, cannot load blog more without restarting site in iis. restarting fixes it, same thing happens when spikes of traffic in day (<200 visits). (i can consistently reproduce problem hitting site iis seo toolkit attempts crawl of pages in site.) that's fixed in 1.8. upgrade...

is it possible to save data from a html form to an excel file with web services? -

i have made newsletter html , css, , in newsletter have 4 text boxes takes users name,family name,phone number,email address.can use web service transfer data html form excel file, or database on host? is possible @ all? saving data html form excel file web services? if yes, how? first of all, assume save data database. approach @ least. so: send data using form server application (asp.net or alike); save in database (or process right away); then use package epplus generate excel file in web service. see project page how that; return result client.

importerror - cx_Freeze program created from python won't run -

i trying create .exe version of python keylogger program found on internet, can run on windows pc's without python installed. code program follows: import pythoncom, pyhook, sys, logging log_filename = 'c:\\important\\file.txt' def key_press(char): logging.basicconfig(filename=log_filename,level=logging.debug,format='%(message)s') if char.ascii==27: logging.log(10,'esc') elif char.ascii==8: logging.log(10,'backspace' else: logging.log(10,chr(char.ascii)) if chr(char.ascii)=='¬': exit() return true hm=pyhook.hookmanager() hm.keydown=key_press hm.hookkeyboard() pythoncom.pumpmessages() after .exe file has been created using build function of cx_freeze, following error occurs in separate error box when run file: cannot import traceback module exception: cannot import name maxrepeat original exception: cannot import name maxrepeat i don't have knowledge of cx_freeze @ all...

Make a Java class generic, but only for two or three types -

(i astonished not able find question on stackoverflow, can put down poor googling on part, means point out duplicate...) here toy class returns reverse of put it. works on integers, require minor changes work string. public class mirror { int value; public int get() { return reverse(value); } private int reverse(int value2) { string valuestring = value + ""; string newstring = reverse(valuestring); return integer.parseint(newstring); } private string reverse(string valuestring) { string newstring = ""; (char c : valuestring.tochararray()) { newstring = c + newstring; } return newstring; } public void set(int value) { this.value = value; } } what i'd make class generic, for, say, 2 or 3 possible types. want write is: public class mirror<x, x 1 of integer, string, or magicvalue { x value public x get(){ [...] what's correct syntax? google-fu failing me... :( edit: appears th...

SOLVED: How to jQuery-ify elements returned by ajax call? -

i ask question in drupal context, answer may generic , not depend on drupal. i have html elements updated/replaced via jquery/ajax. on first page load, elements processed jquery. however, links included in data returned after ajax call ignored jquery. // standard function ensures elements processed after first page load: drupal.behaviors.events = function(context) { // works intended. clicking on links works intended: $('.event_browse_location .parent_locations a:not(.events-processed)', context).addclass('events-processed') .bind('click', function() { $.get(drupal.settings.basepath + '/events/location/' + parseint(this.id, 10), null, browselocation); return false; }); } var browselocation = function(response) { var result = drupal.parsejson(response); // new elements added dom here: $('.event_browse_location').html(result.dat...

c# - How to remove right side empty space in ToolStripMenuItem -

Image
in screenshot marked empty space green rectangle, want left , right space equal size in toolstripmenuitem right side have bigger empty area can't remove. codes: private void updateworkflowsmenu() { ((toolstripdropdownmenu)tsddbworkflows.dropdown).showimagemargin = false; tsddbworkflows.dropdownitems.clear(); program.hotkeymanager.hotkeys.foreach<hotkeysettings>(x => { if (x.tasksettings.job != hotkeytype.none && (!program.settings.workflowsonlyshowedited || !x.tasksettings.isusingdefaultsettings)) { toolstripmenuitem tsmi = new toolstripmenuitem(x.tasksettings.description); if (x.hotkeyinfo.isvalidhotkey) tsmi.shortcutkeydisplaystring = " " + x.hotkeyinfo.tostring(); tsmi.click += (sender, e) => handletask(x.tasksettings); tsddbworkflows.dropdownitems.add(tsmi); } }); tsddbworkflows.vis...

ios - UISearchBar issues Xcode 5 -

i having issues uisearchbar have implemented. app compile , run, hit search bar begin typing word in, crashes. can tell me if see wrong syntax? suppose go through states have in nsarray . tableviewcontroller.h : #import <uikit/uikit.h> @interface tableviewcontroller : uitableviewcontroller <uisearchbardelegate> @property (nonatomic, strong) nsmutablearray *results; @property (nonatomic, strong) iboutlet uisearchbar *searchbar; @end tableviewcontroller.m : #import "tableviewcontroller.h" #import "viewcontroller.h" @interface tableviewcontroller () @end @implementation tableviewcontroller { nsarray *states; } - (nsmutablearray *)results { if (!_results) { _results = [[nsmutablearray alloc] init]; } return _results; } - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; states = [nsarray arraywithobjec...

xml - how to use maya created objects in java? -

we use blender created objects in 'jmonkey' xml file installing 'ogre blender xml'. there process maya blender?? i didn't find anywhere it looks jmonkey supports obj format, maya can export if have objexport.mll plugin install. obj not animatable, however. http://www.ehow.com/how_6948513_export-_obj-file-autodesk-maya.html

ibm mobilefirst - Worklight 6 - What is the purgeEventTransmissionBuffer() -

i want know purpose of using purgeeventtransmissionbuffer() client api in worklight 6 . the worklight 6 api states: purgeeventtransmissionbuffer() purges internal event transmission buffer. internal event transmission buffer purged, , events awaiting transmission permanently lost. this not clear. an example or code snap highly appreciated. the purgeeventtransmissionbuffer api method part of api set belonging location services feature (also in user documentation ) introduced in worklight 6.1. you can create event either using trigger or calling wl.client.transmitevent . api method above clears pending events.

ios - Access UINavigationViewController from UIImageView class -

i have uiimageview custom class. when image pressed class should push new view controller, don't seem able reference current uinavigationcontroller. self.navigationcontroller, here can't. tried following code doesn't work: [self.window.rootviewcontroller.navigationcontroller pushviewcontroller:browser animated:yes]; give custom image view delegate: @protocol customimageviewdelegate; @interface customimageview : uiimageview @property (weak, nonatomic) id<customimageviewdelegate> delegate; @end @protocol customimageviewdelegate - (void)imageviewpressed:(customimageview *)imageview @end make view controller delegate. when image pressed, [self.delegate imageviewpressed:self . your view controller have implementation: - (void)imageviewpressed:(customimageview *)imageview { [self.navigationcontroller pushviewcontroller:browser animated:yes]; } or give view navigation controller property: @interface customimageview : uiimageview @...

JSON converter on azure mobile service queries -

one of tables in azure mobile has column defined number. on client side column maps enum. have json converter marshals enum value int (code below). class completedstateconverter : jsonconverter { public override bool canconvert(type objecttype) { return objecttype == typeof(completedstate); } public override object readjson(jsonreader reader, type objecttype, object existingvalue, jsonserializer serializer) { if (reader.tokentype == jsontoken.null) return completedstate.notcompleted; int intval = serializer.deserialize<int>(reader); completedstate gamecompleted = (completedstate)intval; return gamecompleted; } public override void writejson(jsonwriter writer, object value, jsonserializer serializer) { completedstate gamecompleted = (completedstate)value; int number = (int)gamecompleted; serializer.serialize(writer, number); } } all worked fine until needed make...

excel - Sorting data by range of numbers -

i recieve table of data sorted purchase order po number in asc. further analysis of data, i'm supposed sort out business directions (sectors or departments e.g.). there range of order numbers, each of them related particular direction, 1000-1999 direction a, 2000-2999 direction b. ideally, need them automatically sorted in ascending order additional sum row underneath , direction name above. problem is, quantity of digits in number not limited, means orders might added 1 digit aside, or slash , letter, 2000/a, or 20,000 - , last 1 supposed in range of 2000-2999 pos. what might used solve problem? i'm not solve problem. fucntion successively shrink string right until number. can enter function vba module , use in spreadsheet. function getnumber(s string) integer dim integer = len(s) 0 step -1 if isnumeric(left(s, i)) getnumber = left(s, i) = 0 end if next end function if works, i'm glad. if doesn't...

c - Easiest way to allocate "blank" block of data to .dat file -

looking quick way allocate block of data managed disk. i'm allocating block of 50 structs, , while of memory allocates fine, when read junk messages returned in of fields should blank. assume me allocating space incorrectly somehow allows junk memory leak in there. if ((fpbin = fopen(binaryfile, "w+b")) == null) { printf("could not open binary file %s.\n", binaryfile); return; } fwrite(fpbin, sizeof(struct student), 50, fpbin); //write entire hash table disk struct definition typedef struct student { char firstname[20]; //name char lastname[20]; double amount; //amount owed char stuid[5]; //4 digit code }student; is how taught, yet i'm still getting junk in data instead of being clean slate. question: how set fields blank? answer: student tempstu[50] = {0}; fwrite(tempstu, sizeof(struct student), bucketsize, fpbin); //write entire hash table disk fwrite(fpbin, sizeof(struct student), 50, fpbin); you...

ios - UICollectionViewCell Not drawing cell on indexpath.row == 0 -

Image
see image attached. i'm using basic uiflowlayout subclass accompany view, no matter i've tried, decides doesn't need draw cell 0, however if scroll down , up, draw properly. it seems it's ios sdk bug, need investigate further. wondering if knows ideas try this. this answer solve it: uicollectionview flowlayout not wrapping cells correctly (ios) 1 but case unique using uidynamicanimator calculate layout attributes. so code went this: -(nsarray *)layoutattributesforelementsinrect:(cgrect)rect { return [self.dynamicanimator itemsinrect:rect]; } -(uicollectionviewlayoutattributes *)layoutattributesforitematindexpath:(nsindexpath *)indexpath { return [self.dynamicanimator layoutattributesforcellatindexpath:indexpath]; } - (uicollectionviewlayoutattributes *)layoutattributesforsupplementaryviewofkind:(nsstring *)kind atindexpath:(nsindexpath *)indexpath { return [self.dynamicanimator layoutattributesforsupplementaryviewofkind: kind ati...

javascript - LocalStorage and JSON.stringify JSON.parse -

i have been working on project allows user submit memories place have visited , tracks location of when memory submitted. problem trying use localstorage app, read json.stringify , json.parse, , don't understand how use them in code yet. this form.js processes form , grabs text fields. clears form when add button(on display details page) or enter details button clicked. receives information , sends out message window. function processform(){ var locate = document.myform.locate.value; var details = document.myform.details.value; var storedata = []; localstorage.setitem("locate", json.stringify(locate)); localstorage.setitem("details", json.stringify(details)); alert("saved: " + localstorage.getitem("locate") + ", , " + localstorage.getitem("details")); var date = new date, day = date.getdate(), month = date.getmonth() + 1, year = date.getfullyear(), hour = date.gethours(), minute = date.getmi...

html - How to set footer as last element in all the websites -

please check jsfiddle code.which not coming @ end of page.footer comes before other divs gets finished data. i expect master footer lastone footer appears before right , left divs. css : #main { margin:auto; width:90%; background-color:#b0e0e6; text-align: center; } #header { margin:auto; height:20px; background-color:yellow; } #footer { margin:auto; height:100px; background-color:yellow; } #content { margin:auto; width:100%; } #left { float : left; width:20%; background-color:pink; display: inline-block; } #middle { width:60%; background-color:white; float : left; display: inline-block; } #right { width:20%; background-color:green; float : right; display: inline-block; } #master-head { margin:auto; background-color:#b0e0e6; text-align: center; } #master-foot { margin:auto; background-color:#b0e0e6; text-align: center; } html : <div id="mast...

php - Trying To Make WooCommerce Product Makes Redirect To Affiliate Site -

Image
i trying edit wordpress ecommerce site running woocommerce become affiliate shop. what want create shop lots of product listings , when click on product rather going product page on site user gets sent affiliates product page. here site testing on http://marijuanahealthfacts.com/ , using wordpress theme http://the7.dream-demo.com/ i appreciate , guidance :) this default feature on woocommerce can accomplish setting affiliate product.

mysql - decode is not working correctly after upgrade the php to 5.5 -

i use codeigniter encryption lib keep encoded company name. working php 5.3. upgrade os ubuntu 14.04. php version 5.5. old saved company names not working. same code , same db working in php 5.4 machine. old encrypted company name $name = 'atq1tmbtvclv8iedfcx/+rxhxj1cwxxypybpi/q0cxqe2pimqa/w3ze88199dwfp1l6cfa1msuwedwd1z0gmmw==' $company_name = $this->encrypt->decode($name); echo $company_name; //result - ¾Ôf–s÷nŽ^¨h‡éêÁoðq‹û'É>Åì¦Ô— but works newly created company. issue? it might new php installation doesn't have mcrypt library installed (or new 1 has it, , old didn't) the encoding library checks if extension installed, , if not proceeds custom method: if ($this->_mcrypt_exists === true) { $enc = $this->mcrypt_encode($string, $key); } else { $enc = $this->_xor_encode($string, $key); } the reverse same: if have mcrypt, uses mycrypt_decode($data, $key), else _xor_decode($string, $key). try installing mcrypt $ su...

xcode5 - Can I make Xcode recognize LLDB breakpoints I created outside of Xcode? -

if create breakpoint using xcode's breakpoint navigator (cmd-7), , invoke lldb debugger, can see breakpoints in debugger using lldb command breakpoints list . however, if create breakpoint using lldb debugger directly, instance doing breakpoint set --name 'viewdidload' , not see new breakpoint reflected in xcode. similarly, if enable/disable breakpoints lldb directly, not reflected in xcode. in other words, seems xcode not see lldb breakpoints did not create. xcode not faithful interface lldb. this seems quite busted. there way tell xcode refresh understanding of lldb, picks changes lldb's breakpoint configurations made directly? there not way yet. if able so, please file bug @ bugreporter.apple.com. bug duped, bugs votes features , 1 hasn't gotten done yet because far there's been more important in front of on stack.

apache spark - Avoid "Task not serialisable" with nested method in a class -

i understand usual "task not serializable" issue arises when accessing field or method out of scope of closure. to fix it, define local copy of these fields/methods, avoids need serialize whole class: class myclass(val myfield: any) { def run() = { val f = sc.textfile("hdfs://xxx.xxx.xxx.xxx/file.csv") val myfield = this.myfield println(f.map( _ + myfield ).count) } } now, if define nested function in run method, cannot serialized: class myclass() { def run() = { val f = sc.textfile("hdfs://xxx.xxx.xxx.xxx/file.csv") def mapfn(line: string) = line.split(";") val myfield = this.myfield println(f.map( mapfn( _ ) ).count) } } i don't understand since thought "mapfn" in scope... stranger, if define mapfn val instead of def, works: class myclass() { def run() = { val f = sc.textfile("hdfs://xxx.xxx.xxx.xxx/file.csv") val mapfn = (line: string)...

java - JDBC query table names case insensitive? -

tl:dr; there way select table names case insensitive on jdbc? i try extract table names database on jdbc connection. can resultset tablesrst = connection.getmetadata().gettables( null, null, null, null ); this, however, returns tables, views etc. need first 10 match pattern. know can build myself manipulating arguments. the case of pattern matters, cannot find table aap if pattern a% . is there easy way query table names on jdbc, without having resort database-specific code? that depends on database configuration. if turn off case sensitivity on database, i'm assuming aap come a%.

JavaScript Function Issue (dates) -

i'm having issues javascript code. need make code following: click image twice within 3 seconds make image disappear click once reappear i've got close working...i'm having issues date. don't know how keep date first click. code right creating new start date each click don't want. code far: var imgnext = -1; var start = new date ( ); function disappear () { var end = new date (); imgnext++; if (imgnext == 2) { document.getelementbyid("mypicture").style.visibility="visible"; imgnext = -1; } if (imgnext == 1 && (end-start <3000)) { document.getelementbyid("mypicture").style.visibility="hidden"; } start = new date (); } in code image changes if clicks on 3 seconds apart because i'm creating new start date every time function triggered. how resolve this? cheers. here answer, working example: http://jsfiddle.net/ys5bs/2/ document.getelementbyid("disappear").on...

android - Doesn't call fragment from notification bar -

i calling fragment class notification bar click event. when click on notification bar can't open fragment class have called have checked 1 static boolean variable. still not working. code notification: private void generatenotification(context context, string message) { int icon = r.drawable.kutch_smallpng; long when = system.currenttimemillis(); notificationmanager notificationmanager = (notificationmanager) context .getsystemservice(context.notification_service); // notification notification = new notification(icon, message, when); notificationcompat.builder notificationbuilder = null; string title = context.getstring(r.string.app_name); int requestid = (int) system.currenttimemillis(); intent notificationintent = new intent(context, mainmenuactivity.class); // set intent not start new activity if (notificationintent != null) { notificationintent.setaction("...

c - Assign 1 value of a 3D array to a 1D array -

i have 3d array arr1[16][8][9] , want assign contents of array 1d array arr2[36] . i'm trying: arr2[0] = arr1[0][0][0]; arr2[1] = arr1[0][0][1]; ...... arr2[8] = arr1[0][0][8]; i'm calling function: func_arr(int arr2[36], int arr1[16][8][9]) the function declaration goes like: void func_arr(int arr2[36],int arr1[][8][9]); but array assignment seems invalid. better approach it? function calling seems incorrect. replace below line func_arr(int arr2[36], int arr1[16][8][9]) with func_arr(arr2, arr1); type of first function argument int [36] , passing arr2[36] . assuming arr2 int arr2[36] , type of arr2[36] int , type mis-match. arr2[36] int located @ address after arr2 ends.

javascript - Why I am getting NaN when I toggle the loop? -

i'm trying write k-means function in javascript. , here code. function kmeans(arraytoprocess,cluster_n){ var pointdimension = arraytoprocess[0].length; var clusterresult = new array(); var clustercenter = new array(); var oldclustercenter = new array(); var changed=false; for(var = 0;i<cluster_n;i++) clustercenter.push(arraytoprocess[randomint(arraytoprocess.length-1)]); console.log(clustercenter); // do{ for(var k=0;k<50;k++){//loop for(var = 0; i<cluster_n; i++){ clusterresult[i] = new array(); } for(var = 0; i<arraytoprocess.length; i++){ //for every point element var olddistance=-1; var newclusternumber = 0; for(var j = 0; j<cluster_n; j++){ //for every cluster var distance = math.abs(computedistancebetween(arraytoprocess[i], clustercenter[j])); if (olddistance == -1){ ...

Drupal print all pages as pdf -

i have requirement provide functionality specific user can hit button , export pages in site pdf in 1 go. aware can 1 page @ time, time consuming navigating whole site, need solution programmatically.. in advance! have thought of using views pdf module? https://drupal.org/project/views_pdf