Posts

Showing posts from January, 2015

c# - How to set Textbox's Text as an querystring argument for LinkButton without having codebhind file? -

i having user control file without codebehind file in dotnentnuke. in have put form in have 1 textbox , 1 linkbutton. i want pass textbox's value when press button querystring access in page. for have written following code not work. <asp:textbox id="txtemail" runat="server" class="txtbox" placeholder="enter email here"></asp:textbox> <asp:linkbutton id="linkbutton1" class="lbsubscrb" runat="server" postbackurl="~/portals/_default/skins/gravity/dummy.aspx?add=<% txtemail.text %>" forecolor="white">subscribe</asp:linkbutton> all answers appreciated... it sounds need own custom module, instead of trying take existing module, without source code, , make different? that being said, if want take existing module , make that, jquery going method of choice. basically wan hijack

sockets - .net - SocketException 10054 -

i writing small udp client-server app. server allows connect more 1 client. send message clients use code: // ipendpoints - list<ipendpoint> store clients' ipendpoints // packet - byte[] data (int = 0; < ipendpoints.count; ++i) server.send(packet, packet.length, ipendpoints[i]); to recieve messages use this: //packet - byte[] store data //endpoint - ipendpoint packet = server.receive(ref endpoint); but, when 1 of clients closes connection still try send message endpointand socketexception code 10054. question is, how find out client disconnected? how client's ipendpoint remove ipendpoints list? thought ipendpoint stored in endpoint (passed ref), when exception fired, endpoint remains untouched.

.net - View Shared Folders on a Mapped Drive -

so want view shared folders on mapped network drive. know can use: net share in command prompt view shared folders on local drive. , i've tried below try view shared folders in my mapped drive, l:\ l:\ cd\ net share but again shared folders in local drive shown. searched around internet while , couldn't find anything. forum has similar question none of them seem right really. if there way using .net accept well. only computer hosting files knows folders shared. (try sharing folder on mapped drive.) in order correct way™, you'll have run process ( net share ) on machine serving directory have mapped l:. i believe windows stores share information in registry: hkey_local_machine\system\currentcontrolset\services\lanmanserver\shares if knew machine name serving share you've mapped l: (we'll call server-32), like reg query \\server-32\hklm\system\currentcontrolset\services\lanmanserver\shares this doesn't show of admin shares ( ipc

c++ - QImage RGB32 to QImage RGB24, bad result with some kind of image -

i try convert qimage rgb32 qimage rgb24. code doesn't work in case: when image has additional 1024 bytes in bmp header, size of image x*y*3+54+an unknown 1024 byte. the strange thing code works if image resolution x == resolution y, example: 512x512 or 1024x1024. whatever situation: when have or don't have additional 1024 byte in header. if bmp not have additional 1024 byte in header, every thing works fine if resolution x different resolution y. code : qimage * img=new qimage("test.jpg");//load img rgb32 32bit per pixel whatever format of input qimage * tmp_img=new qimage(img->width(),img->height(),qimage::format_rgb888);// image dest 24bit per pixel uchar * ptr1=img->bits(); uchar * ptr2=tmp_img->bits(); for( int k1=0,k2=0;k1<img->width()*img->height()*4;k1+=4,k2+=3)//increment k1 4 because img format rgb32 //increment k2 3 because tmp_img format rgb888 {

c# - How to publish assets using web-api -

i using mvc web api server application generating client data. in addition, want publish collection of javascript, xap (silverlight) , xml files client-side application. currently, have project structure in directories mixed through .net implementation code (what not like), client app uses uris request these files can not changed. nevertheless, want separate client data server application implementation in different folder. therefore, there way store client data in separate folder, e.g. /clientdata/javascript /clientdata/xap /clientdata/xml /clientdata/... in project, while still being able access these files using uris like /javascript /xap/ /xml/ which urls used client app , again can not changed. this main method of global.asax arearegistration.registerallareas(); routetable.routes.maproute( name: "default", url: string.empty, defaults: new { controller = "home", action = "index", i

symfony - How to handle confirm popup with phantomjs + behat + mink -

in tests use step confirm javascript confirm popup: /** * @when /^(?:|i )confirm popup$/ */ public function confirmpopup() { $this->getsession()->getdriver()->getwebdriversession()->accept_alert(); } this step work fine selenium2 , chrome/firefox, doesn't work phantomjs . how can handle confirm popup phantomjs ? for informations: symfony: 2.0.23 behat: 2.4.6 mink: 1.5.0 symfony2extension: 1.0.2 minkextension: 1.1.4 minkbrowserkitdriver: 1.1.0 minkselenium2driver: 1.1.0 phamtomjs 1.9.1 behat.yml default: extensions: behat\symfony2extension\extension: mink_driver: true behat\minkextension\extension: base_url: "http://localhost:8000/app_test.php" default_session: selenium2 selenium2: wd_host: "http://localhost:9876/wd/hub" thanks! ps: here gist : https://gist.github.com/blazarecki/2888851 i updated "selenium2driver.php&q

.net - Eventhandler for serial port data receiving work only in debug mode -

it's quite strange. eventhandlers serial port seem working in debug mode. problem is, @ hardware side, rx , tx pins connected, means share same data line. in case, there 2 datareceived events triggered after every send. first 1 command itself, , second answer need. here code part: private sub mspserialport_datareceived(byval sender object, _ byval e serialdatareceivedeventargs) _ handles mspserialport.datareceived 'handles serial data received events dim inum integer = mspserialport.bytestoread updateformdelegate1 = new updateformdelegate(addressof updatedisplay) if inum > 0 redim mbreceivebuffer(inum - 1) mspserialport.read(mbreceivebuffer, 0, inum) if inum > 1 me.invoke(updateformdelegate1) end if end if end sub the if-condition "inum > 1" intended neglect first received byte, command itself. works fine in debug

Overriding unwanted page size in SOLR -

i have web application uses solr backend search service. all requests control searches requests: user (type something, choose page size, sort critera) and, after pressing search button, corresponding servlet on web app calls solr. now, parameters sent servlet exposed in browser address bar; because 1) each page on webapp can stored permalink 2) search can controlled changing directly url on top of that, specific parameter, page size, impose constraint. mean: if select menu on web app proposes 3 choices (5,10,15) don't want other values. now, know can in servlet wondering if possible on solr side too...local params? don't know. briefly: "rows" parameters on solr must 5,10 or 20: if value > 20 comes 20 applied. within solr searchhandlers can predefine configuration settings outlined in configuration section. allows set following parameter behaviors defaults - provides default param values used if param not have value specified @ r

python - Evaluation of multilabel and multiclass data labels -

are there evaluation metrics available multiclass-multilabel classification? example, i'm taking part in following competition @ kaggle , requires roc auc evaluation metric.: http://www.kaggle.com/c/mlsp-2013-birds is possible using sklearn? there's library kaggle's director of engineering: https://github.com/benhamner/metrics/tree/master/python

android - Cipher AES, no error exception, but init not works -

i try cipher outputs after "cipher.init" won't output. no exceptions..and don't know why...(new on android) public void login() { logindata logindata = this.fragmentbox.getupdatedlogindata(); string finishstring = new string(); try { cipher cipher = cipher.getinstance("aes"); byte[] output = null; secretkeyspec secretkey = new secretkeyspec( globals.encryptpw.getbytes(), "aes"); system.out.println(secretkey.getencoded().tostring() + "----" + globals.encryptpw); cipher.init(cipher.encrypt_mode, secretkey); output = cipher.dofinal(logindata.getpassword().getbytes()); byte[] encryptedusernamestring = base64.encode(output, 0); finishstring = new string(encryptedusernamestring, "utf-8"); } catch (invalidkeyexception e) { e.getstacktrace(); log.v("

ruby on rails - Submitting an array in a form -

i've been reading question ( ruby on rails: submitting array in form ) didn't answer question. i have form: <div class="signup pull-right"> <div> <p style="color: white">create doctor:</p> <%= form_for(@doctor) |d| %> <%= d.text_field :name[1], :placeholder => "name" %> <%= d.text_field :name[2], :placeholder => "surname" %> <%= d.text_field :email, :placeholder => "email" %> <%= d.text_field :password, :placeholder => "password" %> <%= d.text_field :password_confirmation, :placeholder => "password confirmation" %>

Does Groovy have support for something like Ruby Modules? -

ruby modules make things passing database connection or other dependencies various objects easier while allowing separation of concerns. groovy support similar functionality? , if called? in ruby modules used either mixins or namespace class (e.g. net::http ). to mixin behavior can use @mixin annotation. examples here http://groovy.codehaus.org/category+and+mixin+transformations . to namespace, groovy uses same mechanism java i.e. using packages (e.g. groovy.sql.sql ). i not sure if answered question or not. dependency injection, while common mixin way in ruby (or in scala/play), have not seen done lot using @mixin in groovy. di container spring used.

c - ioctl IOCGIWSCAN : invalid arguments, -

hi i'm trying information iwlist command. got invalid arguments errno, , don't understand why, i'm fellowing paper deals : ioctl & iwreq . code fellowing : #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <stdio.h> #include <netpacket/packet.h> #include <netinet/if_ether.h> #include "ioctlcmd.h" #include <arpa/inet.h> /* siocgiwname 0x8b01 power siocgiwtxpow 0x8b27 siocsiwfreq 0x8b04 set channel/frequency (hz) */ int check_ifname_exist(char * ifname) { int sock = socket(af_packet,sock_raw,0) ; if (sock == ret_err) { printf("error while checking ifname [errno : %d], [strerror : %s]\n",errno,strerror(errno)); return ret_err ; } struct ifreq ifr ; strncpy(ifr.ifr_name,ifname,ifnamsiz) ; int ret = ioctl(sock,siocgifin

serialization - Callback when GameObject is serialized -

is there callback (or other way) notified before unity3d serializes gameobject ? i need similar onserializenetworkview regular gameobject . useful scenarios: store non-serializable fields serializable classes several possible optimizations on class fields any idea? you can have @ this function . if implement custom assetmodificationprocessor, should able preprocess custom gameobject.

.net - IEquatable<T> - Best practice override for .Equals(object obj) in C# -

whenever write new class or struct hold data, may need compared, implement iequatable<t> provides class/struct typed .equals(t other) method. example: public struct radius : iequatable<radius> { public int32 topleft { get; set; } public int32 topright { get; set; } public int32 bottomleft { get; set; } public int32 bottomright { get; set; } public bool equals(radius other) { return this.topleft == other.topleft && this.topright == other.topright && this.bottomleft == other.bottomleft && this.bottomright == other.bottomright; } } as providing implementation .equals(radius other) , should override default implementation ( .equals(object obj) ) i have 2 options here, , question is, of these implementations better? option 1 use casting: public override bool equals(object obj) { return this.equals((radius)obj); } option 2 use "as" keyword: publi

php - Can't obtain the desired template for my arrays -

i'd remove [0] [and on] .php can use them separately , create charts using rickshaw librairy. this json code : array ( [0] => [{"x":"0","y":"35"},{"x":"1","y":"34"},{"x":"2","y":"36"},{"x":"3","y":"35"},{"x":"4","y":"40"},{"x":"5","y":"35"},{"x":"6","y":"37"},{"x":"7","y":"40"},{"x":"8","y":"45"},{"x":"9","y":"46"},{"x":"10","y":"55"},{"x":"11","y":"63"},{"x":"12","y":"61"},{"x":"13","y":"45"},{"x":"14"

class - Simple C++ getter/setters -

lately i'm writing getter , setters (note: real classes more things in getter/setter): struct { const int& value() const { return value_; } // getter int& value() { return value_; } // getter/setter private: int value_; }; which allows me following: auto = a{2}; // non-const object // create copies "default" (value returns ref!): int b = a.value(); // b = 2, copy of value :) auto c = a.value(); // c = 2, copy of value :) // create references explicitly: auto& d = a.value(); // d ref a.value_ :) decltype(a.value()) e = a.value(); // e ref a.value_ :) a.value() = 3; // sets a.value_ = 3 :) cout << b << " " << c << " " << d << " " << e << endl; // 2 2 3 3 const auto ca = a{1}; const auto& f = ca.value(); // f const ref ca.value_ :) auto& g = ca.value(); // no compiler error! :( // g = 4; // compiler error :) decltype(ca.value()) h = ca.value()

c# - Why doesn't this Regex match the date part of the input? -

i attempting take object's text value, obtain information through regex, , type output notepad. below code, , object references correct. have been able type other information notepad, including full text of object regex trying extract, assume there problem match.groups[1].value, can't seem figure out. string pattern= @".*[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}\s[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\s(a|p)m$"; string input = repo.changedbydate.element.getattributevaluetext("text"); match match = regex.match(input, pattern); string dateregex = match.groups[1].value; notepad.textbox.presskeys(dateregex); edit: apologies, posted , without more pertinent information. the above code meant match date/time portion of string original text is: current date , time is: 8/7/2013 12:15:02 pm so want extract 8/7/2013 12:15:02 pm regex assigned pattern . as of now, no output being placed notepad. however, if change code following: string input = repo.changedbydate.

php - Customize 400-401-403-404-500 error page -

i trying customize 400-401-403-404-500 errorr page on website .htaccess file: errordocument 500 /500.php errordocument 404 /404.php errordocument 403 /403.php errordocument 401 /401.php errordocument 400 /400.php it works error 401/403/404 ...but doesn't error 400 , 500..the server don't find pages 500.php , 400.php . any tips? thank indeed http://wiki.dreamhost.com/custom_error_pages try following link might

ios - replace segue, with animation? -

a colleague of mine showed me "replace segue" can use split-view controller. work well. but i'd "cross-fade" old view new view. i've done fades setting alpha property of view, not sure how work using segues. try this: select segue in storyboard in attributes inspector, set style of segue 'modal'. set transition 'cross dissolve' try out , see if that's you're looking for.

python - many-to-many in list display django -

class purchaseorder(models.model): product = models.manytomanyfield('product') vendor = models.foreignkey('vendorprofile') dollar_amount = models.floatfield(verbose_name='price') class product(models.model): products = models.charfield(max_length=256) def __unicode__(self): return self.products i have code. unfortunately, error comes in admin.py "manytomanyfield" class purchaseorderadmin(admin.modeladmin): fields = ['product', 'dollar_amount'] list_display = ('product', 'vendor') the error says "'purchaseorderadmin.list_display[0]', 'product' manytomanyfield not supported." however, compiles when take 'product' out of list_display. how can display 'product' in list_display without giving errors? edit: maybe better question how display manytomanyfield in list_display? you may not able directly. from documentation of list_d

javascript - Button click event on $.post-loaded button -

after filling div $(mydiv).load() call, want catch click event on button inside div. now reason $('.mybutton').click not invoked when click on button loaded through jquery's load function. what best way around this? you have catch event of dynamic object, have use .on() try this: $(document).on('click', '.mybutton', function(){ //your code }); instead of $('.mybutton').click(function(){ //your code });

excel - Finding maximum value in range containing same value -

i have data: b 1 100 1 300 1 200 2 100 2 500 3 100 3 300 3 200 i want select maximumof(b) same value in column1. output should be: b c 1 100 300 1 300 300 1 200 300 2 100 500 2 500 500 3 100 300 3 300 300 3 200 300 i have tried: ={max(if(a:a=a1,b:b))} this gives me maximum value 1 i.e. 300 . how can copy formula other group of cells? gives message you can not move array values . how can achieve this? i suggest delete columnc , start again - using formula in c1. either drag c1 down far required or copy , past c2:c whatever. make sure = inside curly brace.

include - C header file dependencies -

i typically include dependencies in header files when adding header source file, don't need dig around other required headers make compile. however, after reviewing other coding standards, appears banned, requirement header file not contain #include statements. i can't find discussion on - reason banning such practice, or purely down preference? -- e.g. typedef.h contains typedef u8. my_header.h declares void display_message(u8 arg); should reference typedef.h go my_source_file.c or my_header.h ?? i see no reason not allowing headers include prerequisites. consider deleting #include source file. example, suppose code has been modified no longer use foo.h , #include being deleted. source files has dozen #include statements. other ones should delete because no longer needed? hopefully, foo.h documents prerequisites, can identify candidates deletion. however, if delete #include statements, might deleting prerequisite needed different header file. must

Read from a text file and parse lines into words in C -

i'm beginner in c , system programming. homework assignment, need write program reads input stdin parsing lines words , sending words sort sub-processes using system v message queues (e.g., count words). got stuck @ input part. i'm trying process input, remove non-alpha characters, put alpha words in lower case , lastly, split line of words multiple words. far can print alpha words in lower case, there lines between words, believe isn't correct. can take , give me suggestions? example text file: project gutenberg ebook of iliad of homer, homer i think correct output should be: the project gutenberg ebook of iliad of homer homer but output following: project gutenberg ebook of iliad of homer <------there line there homer i think empty line caused space between "," , "by". tried things "if isspace(c) nothing", doesn't work. code below. or suggestion appreciated. #include <stdio.h> #in

java - Adding Keys in CountingBloomFilter Hadoop -

i trying use implementation of countingbloomfilter proposed hadoop. after importing libraries , creating classe, want use method add(org.apache.hadoop.util.bloom.key key) however need add strings filter, how can convert string key function accept? key has constructor accepts byte arrays., can call string's getbytes()

animation - CSS3 onclick activate another DIV's hide/show -

i'm starting in css3, i'm trying make menu this: http://codecanyon.net/item/metro-navigation-menu/full_screen_preview/4573382 the idea when click button, hides parent div , open div daughter other buttons. i saw post css3 onclick activate div's animation points example http://jsfiddle.net/kevinphpkevin/k8hax/ , code: css: #box1 { display:none; } #box1:target { display:block; } html: <a href="#box1">click me</a> <div id="box1">test test</div> that clicking on link, opens div. want click link, hide div, open other , reverse. i use css3 tks help if want use css3 can use checkbox hack ( http://css-tricks.com/the-checkbox-hack/ ). it far ideal css usage setting boxes radio boxes quite each 1 deactivates others. (ie set "width:0px" default, change "width:200px" on check combined "transition: width 0.5s;-webkit-transition: width 0.5s;" bit of animation). in honest

javascript - how to send html with mailto? -

i have following html form... <form id="mform" method="get" enctype="text/plain"> <input name="firstname" type="text" id="firstname"> <input type="submit" class="submit-sponsor-btn" name="submit" value="submit" onclick="javascript:domailto(); return false;" id="submit"> </form> and javascript looks this... var msubject = "become sponsor start connection future talent"; var mfirstname = $('#firstname').val(); var mbody = "<h1>sponsor information below:</h1><p>firstname:"+mfirstname + "</p>"; var smailto = "mailto:memail@something.com?subject="+ msubject + "&body="+ mbody; function domailto() { window.open(smailto); } what need code, enable html tags rendered within e-mail? because of right now, shows element tags along content. thanks

c# - Disable Enter Key in Textboxes -

i developing chatting system. , have button send text in text box chat log. how going stop user press enter key , disable enter key. know there many posts out there this, solutions haven't worked me. i think not need stop user pressing enter instead send chat other person on press of enter. also if have other shortcuts allowed can have @ c#: how make pressing enter in text box trigger button, yet still allow shortcuts such "ctrl+a" through? using same can block private void textboxtosubmit_keydown(object sender, keyeventargs e) { if (e.keycode == keys.enter) { e.suppresskeypress=true; } }

Need some clarification on the ** operator in Python -

i wanted start asking here this. given me part of exercise @ codeacademy.com , confused me better part of hour. take @ following code block: bool_one = 40 / 20 * 4 >= -4**2 now, evaluated being "8 >= 16" false. however, codeacademy.com terminal says it's true. when started writing debug code lines, found issue in how "-4**2" gets evaluated. when run on terminal @ codeacademy on local linux system, "-4**2" in python comes out "-16"... contrary everything have learned in math classes every single calculator have run on. whether run "-4 * -4" or "-4^2" or even, using "x^y" key, "-4 [x^y] 2", still comes out "16". so, how python coming out "-16" "-4**2"? can please clarify me? tia. if have -4 without parentheses, negative sign considered unary operator "multiply negative one." (-4)**2 16, because negative 4 squared, -4**2 uses

c - copying pointer characters not working as expected -

in following code, doing wrong? run code in eclipse , using mingw c compiler. when run eclipse stops responding. when debug code, breaks on line *start = *end; i verified value of *start , *end in debug mode , none null. void func1(char *str) { char *end, *start; end = start = str; char tmp; if (str) { while (*end) ++end; --end; while (start < end) { tmp = *start; *start = *end; *end = tmp; start++; end--; } } } any tips/ideas? so according feedback passing string literal, "hello world" func1 , modifying string literal undefined behavior, alternatively use , work: char arr1[] = "hello world" ; func1(arr1) ; although adam , kerrek pointed out need add more error checking code should fix immediate problem.

Avoiding too many Angularjs Directives -

i have following directive: .directive('mydirective', function() { restrict: 'a', templateurl: 'app/templates/sometemplate/html', }); in template (sometemplate.html) have following: <div> <div>some div</div> <input type="button" value="button" /> </div> i want add behavior button , div. can go route of adding directives so: <div> <div div-click>some div</div> <input type="button" value="button" button-click /> </div> and adding more directives , binding click events via element.bind(... there best practice? should adding behavior in 'mydirective' containing elements? via jquery or jqlite . clickable elements inside template not meant resuable..so should use jquery find elements , bind event listeners them? can see how can directives explosion using directive route, best practice? the question me on directives

How can I tell wagon-maven-plugin to use a username and password from my settings.xml? -

i'm generating (non javadoc) documentation of rest api using plugin named maven-enunciate-plugin . want upload javadoc repository. i'm using wagon-maven-plugin this. the problem is, can't figure out how tell wagon plugin use username/password in settings.xml site. if use maven-site-plugin , seems know how defining distributionmanagement tag, i'm not using maven-site-plugin plugin because i'm generating documentation without it. here's pom show i've tried: <profile> <id>generate-rest-doc</id> <build> <plugins> <plugin> <groupid>org.codehaus.enunciate</groupid> <artifactid>maven-enunciate-plugin</artifactid> <version>1.27</version> <executions> <execution> <goals> <goal>doc

JAVA - LWJGL - Texture rotation -

can tell me real quick how rotate texture var degrees in lwjgl when have coordinates , origin? well, looks right now: x/y center of texture. public void render(float x, float y) { glpushmatrix(); texture.bind(); gltranslatef(x - xorigin, y - yorigin, 0); //this false. ignore //glrotatef(45f, 0f, 0f, 1f); glbegin(gl_quads); { gltexcoord2f(0, 0); glvertex2f(0, 0); gltexcoord2f(0, width); glvertex2f(0, height); gltexcoord2f(texture.getwidth(), texture.getheight()); glvertex2f(width, height); gltexcoord2f(texture.getwidth(), 0); glvertex2f(width, 0); } glend(); glpopmatrix(); } thanks if want rotate textures need change uv coordinates, thereby rearranging gltexcoord2f(u, v) though rearranging them rotate them 90deg/1.57rad per rearrange, though if want smaller rotations of texture, can calculate u, v coordinates using trigonometry cos , sin functions.

php - Get language of Instagram post through API? -

i using following url scrape popular images/videos instagram (using php). https://api.instagram.com/v1/media/popular?client_id=client-id it returns json object, not see value "language". problem because captains in arabic or else , need them english web app. there anyway know language of post or have use language detecting function? checkout this source code, , this demo. have pass captions in detect language. checks 52 languages. can use google translate's api.

Where is the location using android File access with cordova/phonegap -

Image
i started using phonegap android app development. trying write file using code (following phonegag example). document.addeventlistener("deviceready", ondeviceready, false); // cordova ready // function ondeviceready() { window.requestfilesystem(localfilesystem.persistent, 0, gotfs, fail); } function writetext(file, text) { filename = file; texttowrite = text; window.requestfilesystem(localfilesystem.persistent, 0, gotfs, fail); } function gotfs(filesystem) { filesystem.root.getfile(filename, {create: true, exclusive: false}, gotfileentry, fail); } function gotfileentry(fileentry) { fileentry.createwriter(gotfilewriter, fail); } function gotfilewriter(writer) { writer.seek(writer.length); writer.write(texttowrite); console.log("output: " + texttowrite); } function fail(error) { console.log(error.code); } in android emulator eclipse debugger, can see lines executed (log line printed out). no errors anywhere. however,

Using Flavors in gradle when importing project from Eclipse to Android Studio -

for 2 days im trying create 2 different flavors in android app. imported app android studio eclipse. created 2 res folders (res_testing , res_distribution) , 2 src folders (src_testing , src_distribution). how build.gradle looks like: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' task wrapper(type: wrapper) { gradleversion = '1.6' } dependencies { compile filetree(dir: 'libs', include: '*.jar') } android { compilesdkversion 17 buildtoolsversion "18.0.1" sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] resources.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } productflavors {

javascript - on('change') not working as expected -

below code working 1 cycle of select , deselect all. works fine if change syntax .change instead of .on('change') . .change works upto 1.8.3 version of jquery not after that. <div id="mainframe" align="center"> <div align="left"><strong>select checkbox demo.</strong></div> <table border="0" cellpadding="5" cellspacing="1" class="table"> <th><input type="checkbox" id="selectall"/></th> <th>programming language</th> <th>rating</th> <tr> <td align="center"><input type="checkbox" class="case" name="case" value="1"/></td> <td>php</td> <td>5</td> </tr> <tr> <td align="center"><input type="checkbox" class="case" na

xpath - How to find an element by using DOM structure in Selenium? -

my application integrates google maps , i'm trying write ui tests using selenium. part of 1 of tests, need find x in infopopup provided google maps. element not have id or class can use directly find in selenium. can use xpath make test brittle changes google. on other hand, can walk dom structure custom elements (use parent , sibling) , find (this how accessing in javascript). question whether can access same way in selenium. html form: <div style="width: 10px; height: 10px; overflow: hidden; position: absolute; opacity: 0.7; right: 12px; top: 12px; z-index: 10000; cursor: pointer;"> <img src="http://maps.gstatic.com/mapfiles/mv/imgs8.png" draggable="false" style="position: absolute; left: -18px; top: -44px; width: 68px; height: 67px; -webkit-user-select: none; border: 0px; padding: 0px; margin: 0px;"> </div> xpath: //*[@id="map"]/div[1]/div[1]/div/div[3]/div[3]/div/div[13]/div[1] i have limit

git - How can I automatically push changes from a remote repository to Github? -

i have been trying using crontab automatically run bash script pushes changes github. when run script in shell command line, works perfectly. isn´t working crontab. this crontab file (it executing every 2 minutes because of testing purposes): */2 * * * * ./script.sh this script: #!/bin/bash cd /path/to/repo.git git push origin because of testing purposes removed passphrase ssh key connection github try $ git push -q origin that is, assuming git in standard directory. otherwise, add whole path. also, check output in /var/log/syslog .

google app engine - Replacing CURL with urlfetch in PHP -

i'm creating application google app engine, curl isn't allowed. far know, urlfetch best alternative. i don't know if can achieve same result urlfetch, really, appreciate if more experience me out. the plan convert following curl requests urlfetch. if can point me in right direction, or propose better alternative, i'd appreciate it. public function postcall($endpoint, $post_data, $param1, $param2, $json=1, $headers=false) { $ch = curl_init(); curl_setopt($ch,curlopt_url, $this->options['url'].$endpoint); curl_setopt($ch,curlopt_returntransfer, 1); if ($headers && is_array($headers)) { curl_setopt($ch, curlopt_httpheader, $headers); } $post_data['req_token'] = $this->hash($param1, $param2); curl_setopt($ch, curlopt_post, count($post_data)); if (!$headers) curl_setopt($ch, curlopt_postfields, http_build_query($post_data)); else curl_setopt($ch,curlopt_postfields, $post_data); $this->debug('post params: ' . j

android - Issues with inputstream outofmemory errors -

i'm using springframework android inputstreams. @override public inputstream getimagestream(string url) { inputstream = new bytearrayinputstream(template.getforobject(url, byte[].class)); return is; } for first few inputstreams going ok. no problems @ all, then, think tries big inputstream. outofmemory error. i see lot of posts using following code: public byte[] readbytes(inputstream inputstream) throws ioexception { bytearrayoutputstream bytebuffer = new bytearrayoutputstream(); int buffersize = 1024; byte[] buffer = new byte[buffersize]; int len = 0; while ((len = inputstream.read(buffer)) != -1) { bytebuffer.write(buffer, 0, len); } byte[] bytearray= bytebuffer.tobytearray(); return bytearray; } the idea of code read inputstream in chunks right? but outofmemory error i'm getting before can start readbytes method. tried putting resets everywhere...i thought maybe should clear memo

javascript - jQuery Tokeninput and the onFreeTaggingAdd callback -

the jquery plugin tokeninput (master branch) ( https://github.com/loopj/jquery-tokeninput ) has new feature adding tags. unfortunately feature far best documented @ twitter: https://twitter.com/loopj/status/332249287062851585 . i'm trying figure out how use onfreetaggingadd, unfortunately i'm jquery , javascript newbie. in short callback take output api , use in tokenbox. way able modify tag (lower case etc) , add id. able replace id/tag if that's policy suggested api. below, please see code far. i've tried several options set item=data , return value, far without success. appreciated! onfreetaggingadd: function (item) { $.post("../php/add_tagg_02.php", {tag: item, userid: "userid-dummy"} ) .done(function(data, status, xhr) { alert ("your suggested new tag " + data.name + " entered in database , considered future use."); console.log( data.name ); //returns "new" name api console.log( data.id ); //returns id

javascript - Highcharts columns have no width (seemingly arbitrarily) -

i'm working column chart using highcharts. chart needs handle arbitrary number of columns. here's example of 1 such chart need handle: $('#timeschart2').highcharts({ chart: { type: 'column' }, title: { text: 'response times' }, xaxis: { type: 'datetime', datetimelabelformats: { // don't display dummy year month: '%e. %b', year: '%b' } }, yaxis: { title: { text: 'minutes' } }, series: [{ name: 'average response time', data: [[date.utc(2013, 6, 30), 878.42], [date.utc(2013, 6, 31), 579.68], [date.utc(2013, 7, 1), 400.42], [date.utc(2013, 7, 2), 622.95], [date.utc(2013, 7, 5), 1260.97], [date.utc(2013, 7, 3), 0], [date.utc(2013, 7, 4), 0], [date.utc(2013, 7, 6), 517.945] ],

Cognos report studio group for subtotals -

Image
i have report grouped column cities. when add total amount field, doesn't display subtotals each city... grand total @ end. how add subtotal row in cognos report studio? you got simple list , dragged columns it, want group , data want sum up. in example here used "shop", "year" , "sales volume": now select first column, in example "shop" , click on button marked red in screenshot: do same second column, in example "jahr / year". after that, click on column holds data want measure, in example "sales volume / auftraggesamt" , click on button sum symbol. can choose how aggregate data. as can see multiple rows added. got row under each shop, holding sum each shop. , @ bottom have row holding sum shops.

php - regular expression parse url parameter -

i'm having trouble retrieving url parameter string using regular expressions: an example string be some text , http://google.com/?something=this&tag=yahoo.com , more text , , able find yahoo.com this. the caveat need ensure string begins http://google.com , , not search &tag=(.*) preg_match("/google\.com\/.*&tag=(.*) $/", $subject, $matches) i'm hoping matches google.com followed anything, followed &tag= followed space. goal parse out of tag= values google.com urls. is there better way accomplish this? update: so have new regex: /google\.com\/.*(tag=.*)/ i'm not sure how end on space after url get friendly parse_url() function! $pieces = parse_url('some text http://google.com/?something=this&tag=yahoo.com , whatever'); $query = explode('&', $pieces['query']); parse_str($pieces['query'], $get); array_walk($get, function(&$item){ if (!$sp = strpos($item, ' '

rebol - How to "unmold" a string? -

i'm using this library convert block csv. however, when encounters string comma in it molds string. not problem except curly-braces seem confuse excel. so, {this, test} gets turned | {this | test} | (each side of comma put separate cells). at first thought needed escape comma turns out need turn curly braces quotes. there quick or rebol-recommended way this? the purpose of 'mold in %csv.r wrap values containing commas double quotes. but unfortunately 'mold puts strings longer 50 characters curly braces instead of double quotes, better readability. i don't know how affect behaviour, replace 'mold in item: mold item , heading: mold heading 'dbl-quote, defined as dbl-quote: func[s][rejoin [{"} s {"}]]

Javascript function that is equivalent for PHP function -

this question has answer here: validate decimal numbers in javascript - isnumeric() 46 answers i have follwing code in php: if(is_numeric($first_name[0]) === true){ //do } how able same check using javascript? php script check if there number in $first_name @ all, don't want user add number in first or last names please? use regular expressions. if (/-?\d+(?:\.\d*)?(?:[ee][+\-]?\d+)?/.test(yourinput)) { // } of course, work on strings. different method, see duplicate question : function isnumber(n) { return !isnan(parsefloat(n)) && isfinite(n); } to check if input contains number (0-9) @ all, regex works again: if (/[0-9]+/.test(yourinput)) { // }

Getting undefined from javascript array of arrays -

this linked previous question different , whole new question... have array, after nice php looks this: var series = { "001":{ "game":"portal 2", "name":"portal 2" }, "002":{ "game":"minecraft", "name":"241" }, "003":{ "game":"minecraft", "name":"hackmine" }, "004":{ "game":"mass effect 3", "name":"mass effect 3" }, "005":{ "game":"league of legends", "name":"league of legends" }, "006":{ "game":"half life 2", "name":"the hidden: source" }, "007":{ "game":"skyrim", "name":"modded s

uitableview - UITableViewController not displaying -

is there way add tableview portion of uitableviewcontroller uiview? here i've got... 1) uiviewcontroller - mainviewcontroller 2) uiview - customuiview - added mainviewcontroller (this uiview replaced when new page loaded) when button clicked of other pages in app loaded using (example) mainviewcontroller.customuiview = [[loginpage alloc] initwithframe:mainviewcontroller.view.bounds]; 3) uitableviewcontroller - scoresnotificationspage - here issue, trying add tableview portion of uiview , have display on mainviewcontroller, if other uiview added. when try loading tableview portion of uitableviewcontroller customuiview using: mainviewcontroller.customuiview = [[scoresnotificationspage alloc] initwithframe:mainviewcontroller.view.bounds]; i following error incompatible pointer types assigning 'uiview *' 'scoresnotificationspage *' any idea of tableview show up? thank in advance. whew... make scoresnotificationspage child v

javascript - RequireJS Optimizer - One JS File vs. Whole Project -

i have requirejs project several webpages. each webpage there's main/require-configuration js file loaded. structure this: something this: - p1.html - p2.html - /scripts - main1.js - main2.js - /controllers -... - /views -... - /css - /images i have r.js build profile file each "flow" (build-flow1.js, build-flow2.js). i'm using requirejs optimizer (running r.js) optimize single js each flow. i'm reconsidering build configuration since couldn't explain myself earn, @ runtime, using requirejs if build single, concatenated js file. understand having code modularized requirejs enables r.js compilation, requirejs first , foremost loader framework, seems i'm earning these capabilities... or didn't right? there's documentation building whole project . looks result in other method (single js files), copies side folder , there. what's difference? sounds questioning benefit of bothering requirejs/a

google cast - Open Chromecast YouTube video from my Android app -

i'm able use own whitelisted url feeding chromecast videos, can make stream youtube video directly app? i assume need launch youtube app remotely , feed video id somehow, can't find out how that. has done android app? thanks. not sure if still looking solution this. way follows: mimedata data = new mimedata("v=g1lst1pvjua", mimedata.type_text); msession.startsession("youtube", data); the above should create youtube session , play video.

php - How can I set own Tag class in Volt (Phalcon) -

i want redeclare , add methods helper tag. class mytags extends \phalcon\tag { public static function mytag($params) { <...> } } in services.php $di->set('tag', function() { return new mytags(); }; but works php engine, not volt. {{ mytag() }} returned undefined function 'mytag' first of all: don't use tag service name because it's used phalcon's tag object. secondly can use static methods class. below working example mytag using config app changed names example. $di->set( 'view', function () use ($config) { $view = new view(); $view->setviewsdir($config->application->viewsdir); $view->registerengines( array( '.volt' => function ($view, $di) use ($config) { $volt = new voltengine($view, $di); $volt->setoptions( array( 'compiledpath' => $con

php - can a Try Catch work within a Catch -

i've got try catch in framework i'm using when catch triggered displays error report page, 1 thing in report page displays menu times came database what thought it's i'd put try catch in catch in case if database can connected to, this try { code throw excpetion } catch(exception $e) { try { connect database run query log error in database output screen using database data } catch(exception $e) { output screen using static html } } this way if exception database connection error use static html output rather dynamic 1 generated database data however when cause database error (deleting required table) static html doesn't work i wondering if possible try catch work in catch or weather it's framework (i'm using magento), ask because if possible done i'll spend time figuring out why framework stopping me yes, possible put try/catch block in catch block. however, desc