Posts

Showing posts from September, 2015

Need to Replace properties of single sql file using bat file -

Image
how replace values/properties of .sql file using input .bat file. when calling batch file, use %1, %2, etc. pass parameters. can use same passed parameters in stored procedure. so, in batch file, call command line version of database (which version?) , run stored proc. here example. %1 in batch file replaced "sam" passed @ command line.

android - Sharing selected text -

i have book-like application , suppose have option of selecting text , sharing it. to make text selectable use edittexts instead of textviews , how can share part of text? i know how text string variable, problem when select text - have standart edittext dialog @ top of screen has options "select all","copy" etc hides action bar, there no way can select text , click "share" on actionbar because it's hidden "copy-select all" panel. what can suggest? you override function "performlongclick".

ios - Push notification not supporting existing app Id? -

Image
hi have 1 ios app in app store,so when create app id didnt checked "push notification" (didnt selected option).its 3 months ,but want add push notification in new version 1.4 .but not able enable pushnotiication now.?? there way fix this? bundle identifies in form of company.exampleapp or need upload new app? please help. you need go edit app id , follow steps enable push notifications. afterwards, need profile again , create ipa updated profile. if using urban airship need change flag value yes "inproduction" in airshipconfig.plist file.

javascript - Nav Sidebar like on Google and Twitch -

i'm trying recreate sidebar: http://www.twitch.tv/directory there's 1 on youtube: http://www.youtube.com/ when window height small scrollbar appears in sidebar, , no matter how large window height it's stuck bottom. content go on right side (the same youtube). there online tutorial or recommendations can follow recreate this? i'm trying find 1 haven't had luck. many thanks. i think you're after might j panelmenu: http://jpanelmenu.com/ completely customisable. have used few businesses such as: http://www.kapowinteractive.com.au/ if bring width in, can see icon pop in top left corner. click , navigation opens up. think may starting point you.

python 2.7 - Chat Solution for Mobile App -

i looking chat solution can integrate mobile app. far, have been looking python solutions , have come across "chat demo in tornado" library. there more advanced solutions can ? chat demo link : https://github.com/facebook/tornado/tree/master/demos/chat there play2 (java) app has been developed example heroku makes use of redis , websockets: https://github.com/heroku-examples/play-websockets-chat-sample it helpful.

jquery - Detect current Section with javascript -

i'm working on onepage website. have fixed menu in pure html, here's code : <header class="header-menu"> <div class="header-menu-inside"> <h1>wm flying</h1> <nav class="menu menustandard"> <a class="target-section1 current" href="#section1">home</a> <a class="target-section2" href="#section2">about</a> <a class="target-section3" href="#section3">portfolio</a> <a class="target-section4" href="#section4">the team</a> <a class="target-section5" href="#section5">contact</a> </nav> </div> </header> <div class="main" id="main"> <section id="section1" class="home"> </section> <secti

internationalization - Translating Views Exposed filters Label -

i'm trying translate views exposed filters labels on site. manage have exposed filters translated internationalization views module. tried string override module translate exposed filters labels far no luck. please point me in right direction? thanks

avahi - Where multicast packets could be filtered? -

i installed openwrt distro on router , enable support of avahi in it. goal discover network services in network. i plugged pc lan port announced services. on router run tcpdump on bridge interface : tcpdump -i br0 -vvn udp port 5353 during avahi browse execution receive output: root@localhost:~# avahi-browse -art 21:55:22.995004 ip (tos 0x0, ttl 255, id 0, offset 0, flags [df], proto udp (17), length 74) 192.168.1.1.5353 > 224.0.0.251.5353: [udp sum ok] 0 ptr (qm)? _services._dns-sd._udp.local. (46) but on pc wireshark didn't show multicast queries during call, hence no services found. does mean router filter multicast packets somehow? way know filter in ebtables, shows nothing filtering of mdns addresses: root@localhost:~# ebtables -l bridge table: filter bridge chain: input, entries: 1, policy: accept -j ro_input bridge chain: forward, entries: 1, policy: accept -j ro bridge chain: output, entries: 1, policy: accept -j igmpproxy bridge chain: ro, entr

ios - UITextView Fixed Size and Stop Auto Resizing -

Image
i'm trying add editable text block uiscrollview (so text blocks scroll when keyboard shows up) buttons can change. problem creating uitextview programmatically , adding uiscrollview 's subview prevents buttons being able access uitextview.text . added uitextview in scrollview in storyboard , uitextview autoresized 1 character since starts no text. i've tried using cgrectmake , uitextview won't keep width fixed. user won't able see texting 1 character visible @ time. suggestions on how have fixed width, editable textview , added scrollview keyboard can show, doesn't automatically resize? here code: @interface inventoryviewcontroller () @property (weak, nonatomic) iboutlet uitextfield *texttitle; @end @implementation inventoryviewcontroller @synthesize texttitle; -(void) createviewwithtitle { uiview *whiteview = [[uiview alloc] initwithframe:cgrectmake(0.0f, 0.0f, 320.0f, 400.0f)]; whiteview.backgroundcolor = [uicolor redcolo

Join five array values into a single array where all the array variable is same and the array contents are different javascript -

here have written javascript array (var a=[""]) consists of different values in each if condition, want array values stored in single array seperated comma(,). can me?? here javascript <script> function colorchange(id) { var background = document.getelementbyid(id).style.backgroundcolor; if (background == "rgb(255, 145, 0)") { document.getelementbyid(id).style.background = "rgb(26,255,0)"; } else { document.getelementbyid(id).style.background = "rgb(255, 145, 0)"; } var elem = document.getelementbyid(id); if (id == "select") { if (elem.innerhtml == "ignore select") { elem.innerhtml = "enable select"; var = ["select"]; //array returns select } else { elem.innerhtml = "ignore select"; } } if (id == "select1") { if (elem.innerhtml == "ignore delete&

Magento add wysiwyg to custom frontend form -

i'm writing module, , i'm searching how add build-in wysiwyg editor textarea in frontend. possible? knows, how implement that? so, keeping final solution in case need : 1) put code in .phtml file want editor appear directly. 2) in 6th line of code can see elements: "short_description" . can change "short_description" element id want. can add more 1 element id separated comma , without spaces. example: put code in app/design/adminhtml/default/default/template/catalog/product/edit.phtml because want editor appear directly when edit product's description, short description etc. the code: <script type="text/javascript"> window.onload=function() { tinymce.init({ mode : "exact", elements: "short_description", theme : "advanced", plugins : "inlinepopups,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,con

deployment - Deploy Grails 2.3.0 to Glassfish Server -

i have application build grails 2.3.0 , type command 'grails war' generate war file. type following command deploy application : asadmin deploy app_path/target/myapp.war but following error: remote failure: error occurred during deployment: exception while deploying app [myapp] : org.xml.sax.saxparseexception; linenumber: 137; columnnumber: 15; deployment descriptor file web-inf/web.xml in archive [myapp]. cvc-complex-type.2.4.a: 從元素 'init-param' found invalid content。expect '{"http://java.sun.com/xml/ns/javaee":run-as, "http://java.sun.com/xml/ns/javaee":security-role-ref, "http://java.sun.com/xml/ns/javaee":multipart-config}'。. please see server.log more details. i use grails 2.3.0 , same error on both glassfish 3.1.2.2 , glassfish 4. how can fix error ? appreciate. -- update i use grails command "grails install-templates" generate web.xml, , move web.xml web-app/web-inf, still got same error message

sd card - Android Open External Storage directory(sdcard) for storing file -

Image
i want open external storage directory path saving file programatically.i tried not getting sdcard path. how can this?is there solution this?? private file path = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures) + ""); or private file path = new file(environment.getexternalstoragedirectory() + ""); i tried getting path above both methods both pointing internal memory. when open storage memory if sdcard peresent shows below- device storage & sd memory card. i want sd memory path through coding. have given permissions in manifest- <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.storage" /> <uses-permission android:name="android.permission.read_external_storage" /> i had been having exact same problem! to internal sd card can use string extstore = system.gete

java - How to copy header and footer from one pdf to another -

i need create report in pdf in java. report being created in 2 steps. 1. create textual part of report on first page (with header/footer) 2. create graphic part of report in next page. (using itext pdf) graphics part, need copy header/footer first page , add other pages. can guide me how can achieve in itext or other similar library.

android - Why AVCodecContext extradata is NULL? -

i trying decode h264 video using ffmpeg , stagefright library. i'm using this example. the example shows how decode mp4 files, want decode h264 video. here piece of code.. avformatsource::avformatsource(const char *videopath) { av_register_all(); mdatasource = avformat_alloc_context(); avformat_open_input(&mdatasource, videopath, null, null); (int = 0; < mdatasource->nb_streams; i++) { if (mdatasource->streams[i]->codec->codec_type == avmedia_type_video) { mvideoindex = i; break; } } mvideotrack = mdatasource->streams[mvideoindex]->codec; size_t buffersize = (mvideotrack->width * mvideotrack->height * 3) / 2; mgroup.add_buffer(new mediabuffer(buffersize)); mformat = new metadata; switch (mvideotrack->codec_id == codec_id_h264) { mconverter = av_

android - Nested retained FragmentTabHost doesn't attach tabs to new Activity -

i have been playing around fragmenttabhost android v4 support library while , came upon serious issue couldn't resolve. target requirements follows. 1) fragment include tabs built fragments include nested fragments well, hierarchy this: android.support.v4.app.fragment (hostfragment) android.support.v4.app.fragmenttabhost (tabhost) android.support.v4.app.fragment (tab1fragment) android.support.v4.app.fragment (tab1fragment1) android.support.v4.app.fragment (tab1fragment2) android.support.v4.app.fragment (tab1fragment3) android.support.v4.app.fragment (tab2fragment) android.support.v4.app.fragment (tab2fragment1) android.support.v4.app.fragment (tab2fragment2) hostfragment + tabhost setup done according says in documentation here . 2) upon screen rotation retain status of hostfragment recreation of setup resources consuming operation , besides layout order nothing changes on screen no work needed display screen. return d

android - Export signed app without "optimizing" png images -

when export apk eclipse, compresses of png images. example, 1 4.6 kb png became 2.15 kb inside apk. prefer optimize png files using tinypng before apk built, makes smaller files. same 4.6 kb png became 746 b using tinypng. when building apk, compression ran on 746 b png making 1.6 kb. is there way disable optimization future builds? in project build.xml ant file can override -crunch task of sdk, avoiding png compression, compressed them: <target name="-crunch"> <echo message="skipping png optimization"/> </target>

jquery - Query if class is already shown -

hello need able identify if given class "faded in": private void fadein() { // todo: check first if class shown! otherwise, don't run fade's out when run on faded in class $(".hopscotch-bubble").fadein(new com.google.gwt.query.client.function() { @override public void f() { jsnihelper.infonotify("info", "fade in method invoked."); } }); } how do that? gwtquery fadein finishes showing hidden element $(selector).visible() should return whether element visible. but normally, if want take care of not running 2 animations, normal way in gquery , jquery stop pending animations. $(selector).stop(true).fadein(...);

.htaccess - mod_rewrite issues with URL if page title has dashes -

i have page this: http://www.url.com/folder/content.php?name=this-is-the-page-title&item_id=129 as can see, title of page included in url, separated dashes. so, i'd convert following mod_rewrite: http://www.url.com/this-is-the-page-title-129.html for this, use mod_rewrite rule like: rewriterule ^([^-]*)-([^-]*)\.html$ /folder/content.php?name=$1&item_id=$2 [l] unfortunately, using rule, 404 error. think problem because title separated dashes (-) , separator dash well, can't tell variables each other or that. when change rule dash (-) slash (/) works fine: rewriterule ^([^-]*)/([^-]*)\.html$ /folder/content.php?name=$1&item_id=$2 [l] but url becomes: http://www.url.com/this-is-the-page-title/129.html ...which don't want i'd have rewrite entire structure of page. is there way working http://www.url.com/this-is-the-page-title-129.html even page title being separated dashes? thank :) the problem is, specify ([^-]*) m

bash - Sorting in unix while other field doesn't change -

i have file 1 4 2 1 2 1 1 2 4 5 1 2 4 5 9 2 3 4 5 1 1 0 2 1 5 2 2 2 1 1 sort -k1 file gives 1 0 2 1 5 1 1 2 4 5 1 2 4 5 9 1 4 2 1 2 2 2 2 1 1 2 3 4 5 1 i want first field sorted, others remains should at, e.g. sorted file should give: 1 4 2 1 2 1 1 2 4 5 1 2 4 5 9 1 0 2 1 5 2 3 4 5 1 2 2 2 1 1 similarly sort -k1r testsort gives 2 3 4 5 1 2 2 2 1 1 1 4 2 1 2 1 2 4 5 9 1 1 2 4 5 1 0 2 1 5 when want 2 3 4 5 1 2 2 2 1 1 1 4 2 1 2 1 1 2 4 5 1 2 4 5 9 1 0 2 1 5 how can in unix? try this: sort -s -n -k 1,1 this work, , learn more can see here

linux - Why does find result in an empty new line within backticks? -

for reason, resolving variable name within backticks , double quotes causes empty new line. search="randomsite"; res="`find /var/www -maxdepth 2 -mindepth 2 -type d -name '${search}'`"; echo $res use $() rather backticks - easier read , nestable... res=$(find /var/www -maxdepth 2 -mindepth 2 -type d -name "${search}")

css - Target samelevel and parent lis -

i have example: http://jsfiddle.net/4eblu/ html: <ul> <li><a href="">great britain</a></li> <li><a href="">germany</a></li> <li> <a href="">france</a> <ul> <li> <a href="">paris</a> <ul> <li><a href="">notre dame</a></li> <li class="selected"><a href="">parc des princes</a></li> <li><a href="">sacre coeur</a></li> </ul> </li> <li><a href="">rouen</a></li> <li><a href="">lyon</a></li> <li><a href="">marseilles</a></li> </ul> </li> <li><a href="">sweden</a></li> <l

deep linking - Error starting an activity -

i have intent filter defined in manifest file 1 of activities. when trying start activity adb shell, using following command : $ adb shell start -w -a android.intent.action.view -d "example://gizmos" com.example.android i getting following error : starting: intent { act=android.intent.action.view dat= http://www.example.com/gizmos pkg=com.example.android } error: activity not started, unable resolve intent { act=android.intent.action.view dat= http://www.example.com/gizmos flg=0x10000000 pkg=com.example.android } please help. here manifest entry : <activity android:name="com.example.android.activity.exampleactivity" android:configchanges="orientation|keyboardhidden|screensize" android:screenorientation="portrait" > <intent-filter android:label="search" > <action android:name="android.intent.action.view" /> <cat

r - Plotting randomly selected columns of correlation matrix -

i have big similarity matrix having 444 columns. want plot heatmap or corrplot compare different similarity matrices, can't use columns. want take random sample of columns , plot heatmap, don't want compute similarities again columns takes lot of time similarity functions have. ideas how take random sample of columns similarity matrix (it has same structure correlation matrix) plot heatmap them?

MySQL Categorise data based on two columns -

**base table:** col 1 col2 25 184 35 200 21 75 10 206 55 114 75 190 **expected output:** 0-50 50-100 100-150 >150 0-10 0 0 0 1 10-20 0 1 0 0 20-30 0 0 0 1 >30 0 0 1 2 need write mysql query print count of values 2 columns(col1, col2) rite box in matrix format (as given above). query had used: select case when col1 between 0 , 10 '0-10' when col1 between 10 , 20 '10-20' when col1 between 20 , 30 '20-30' else '>30' end freq, count( case when col2 between 0 , 50 , col1 between 0 , 10 '0-10' when col2 between 0 , 50 , col1 between 10 , 20 '10-20' when col2 between 0 , 50 , col1 between 20 , 30 '20-30' when col2 between 0 , 50 , col1 >30 '>30' end) '0-50', count( case when col2 betwe

c# - Catel/Ninject: Ninject.ActivationException when resolving IUIVisualizerService -

when trying resolve iuivisualizerservice ninject.activationexception came in ninject.dll. can me pls? this code section calls problem: ninjectdependencyresolver resolver = new ninjectdependencyresolver(); var item = resolver.getservice<iuivisualizerservice>(); code resolver: using system; using system.collections.generic; using catel.services; using ninject; using nlog; namespace ms_modell.infrastructure { internal class ninjectdependencyresolver { private ikernel kernel; private logger log = logmanager.getcurrentclasslogger(); public ninjectdependencyresolver() { try { kernel = new standardkernel(); kernel.bind<iuivisualizerservice>().to<uivisualizerservice>(); } catch (exception ex) { log.fatal("ninjectdepende

Turn off caching on Android for WebApps -

honestly, i'm unsure whether should post on so; either way, let's each other out. i'm building web app regularly check on android phone, @ point. instead of uploading phonegap or time, i've configured simple page iframe pointing content of web app (hosted online). the bad thing of this: in order see changes, have clean app cache. else, 'previous' version still showing (because it's stuck in cache). so hoping if there option turn on/off on android/configure within page turns off caching objects , files? thanks lot guys! to give idea of how work.. ------------------------------------------------- | phone | | | | | | ----------------------------------------- | | | cordova/phonegap | | | | application | | | | loads | | | |

image - avconv generating frames in php -

i'm trying generate frames (at moment) on localhost server code: $cmd = 'avconv -i "../videos/medium.mp4" -vsync 1 -r 10 -f image2 -an -y -qscale 20 -s 120*90 -ss 00:00:05 -t 00:00:10 "out_%05d.jpg" 2>&1'; passthru($cmd, $out); i following message: [image2 @ 0x646120]could not open file : out_00001.jpg av_interleaved_write_frame(): input/output error failed1 the problem if run command in terminal works. know whats problem? due permisson or else? before executing $cmd need change directory first, , execute command. chdir('path_to_your_location/videos/'); $cmd = 'avconv -i "../videos/medium.mp4" -vsync 1 -r 10 -f image2 -an -y -qscale 20 -s 120*90 -ss 00:00:05 -t 00:00:10 "out_%05d.jpg" 2>&1'; passthru($cmd, $out);

iphone - preferredContentSize not working instead of contentSizeForViewInPopover -

Image
i working on project want make app compatible ios7. self.contentsizeforviewinpopover = cgsizemake(90, 1 * 65 - 1); this method deprecated ios7 new method self.preferredcontentsize= cgsizemake(90,1*65-1); but not getting proper ui but when changing ios7 compatiable method view this with ios7 method getting this given in apple documentation: this property allows direction manipulation of content size of popover. changing property directly equivalent animated=yes. content size limited minimum width of 320 , maximum width of 600. @property (nonatomic) cgsize popovercontentsize; - (void)setpopovercontentsize:(cgsize)size animated:(bool)animated; i have implemented handle content size of popover & working: self.popcontroller.popovercontentsize = cgsizemake(430, 460);

handling file descriptors java -

whenever our application handles large amount of http request, error "too many open files" being displayed on logs , sure error connected socket , creates new file descriptor instance see error below: [java.net.socket.createimpl(socket.java:447), java.net.socket.getimpl(socket.java:510), java.net.socket.setsotimeout(socket.java:1101), org.apache.http.conn.scheme.plainsocketfactory.connectsocket(plainsocketfactory.java:122), org.apache.http.impl.conn.defaultclientconnectionoperator.openconnection(defaultclientconnecti onoperator.java:148), org.apache.http.impl.conn.abstractpoolentry.open(abstractpoolentry.java:149), org.apache.http.impl.conn.abstractpooledconnadapter.open(abstractpooledconnadapter.java:121), org.apache.http.impl.client.defaultrequestdirector.tryconnect(defaultrequestdirector.java:561), org.apache.http.impl.client.defaultrequestdirector.execute(defaultrequestdirector.java:415), when saw on internet should use entityutils.consume(entity); httpcli

Using shared preferences vs. bundle in Android -

the app i'm making retrieves between 1 , 2 dozen records table in db pieces of data can used during app (the table has 6 fields). won't need stored permanently on device. shared preferences used or should utilizing bundle? you can query db , data want , store in normal fashion in variables. sharedpreferences used when want retain data between different app executions . bundle used when want safely transfer data between activities or between activity , fragment. so unless have such requirements, can store them in normal variables .

java - JavaFx on Eclipse View -

Image
i designing eclipse plugin in eclipse 3.6. have created eclipse view extending eclipse viewpart class. inside view trying use javafx components label, text fields etc. in view have label , text field. problem: cannot make text field editable , text field not gain focus on mouse click on text field. how can make text field gain focus , make editable? using: eclipse 3.6 helios , javafx 2.2 java 7. import java.awt.frame; import javafx.application.platform; import javafx.embed.swing.jfxpanel; import javafx.scene.scene; import javafx.scene.control.label; import javafx.scene.control.tab; import javafx.scene.control.tabpane; import javafx.scene.control.textfield; import javafx.scene.layout.gridpane; import javax.swing.jpanel; import org.eclipse.swt.swt; import org.eclipse.swt.awt.swt_awt; import org.eclipse.swt.graphics.color; import org.eclipse.swt.graphics.device; import org.eclipse.swt.widgets.composite; import org.eclipse.swt.widgets.display; import org.eclipse.ui.part.vie

c# - Putting textfile into Listbox using streamreader -

i wondering how can make program read text file , put contents in listbox using streamreader? private void button1_click(object sender, eventargs e) { } (streamreader stread = new streamreader("c:\users\tommy\desktop\windowsformsapplication9\windowsformsapplication9\bin\debug\transactions.txt")) { while (!stread.endofstream) { listbox1.items.add(stread.readline()); } using file.readalllines be aware of @ @ beginning of file path. using backslash in string literal must escaped if @ not used. listbox1.items.addrange(file.readalllines(@"c:\users\tommy\desktop\windowsformsapplication9\windowsformsapplication9\bin\debug\transactions.txt")); using streamreader : // create instance of streamreader read file. // using statement closes streamreader. using (streamreader sr = new streamreader("testfile.txt")) { string line; // read , display lines file

python - How to printing numpy array with 3 decimal places? -

how can print numpy array 3 decimal places? tried array.round(3) keeps printing 6.000e-01 . there option make print this: 6.000 ? i got 1 solution print ("%0.3f" % arr) , want global solution i.e. not doing every time want check array contents. np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)}) this set numpy use lambda function formatting every float prints out. other types can define formatting (from docstring of function) - 'bool' - 'int' - 'timedelta' : `numpy.timedelta64` - 'datetime' : `numpy.datetime64` - 'float' - 'longfloat' : 128-bit floats - 'complexfloat' - 'longcomplexfloat' : composed of 2 128-bit floats - 'numpy_str' : types `numpy.string_` , `numpy.unicode_` - 'str' : other strings other keys can used set group of types @ once are:: - 'all' : sets types - 'in

ios - Core Data: is there a way to properly change the persistent store at runtime? -

i have problem when trying change persistent store @ runtime. way i'm trying doing reinit of whole core data stack: - (void)initializecoredataforstore:(nsurl *)storeurl withcompletionblock:(coredatarwcompletionblock)completionblock {    //this code needed reset core data stack before re-creating new 1    [_managedobjectcontextbackgroundqueue reset];    _managedobjectcontextbackgroundqueue = nil;    [_managedobjectcontextmainqueue reset];    _managedobjectcontextmainqueue = nil;    _managedobjectmodel = nil;    _persistentstorecoordinator = nil;    _persitentstore = nil;        //---------------end reset core data stack ---------------------        //model    self.managedobjectmodel = [nsmanagedobjectmodel mergedmodelfrombundles:nil];        self.persistentstorecoordinator = [[nspersistentstorecoordinator alloc] initwithmanagedobjectmodel:self.managedobjectmodel];    //main context    self.managedobjectcontextmainqueue = [[nsmanagedobjectcontext alloc] initw

ios - Base internationalization and other localizations, set default language? -

Image
i'm trying localize application in english , italian. if device configured language, want show english version. here screenshots: in .plist file: and storyboard: the problem when set on device language (i.e. french or spanish), showed version last 1 showed among italian , english. i.e. set phone in italian, works fine, change in spanish, , app in italian again. set phone in english, works fine, change in spanish, , app in english again. how can solve having english every non-localized languages? thank in advance answers. what try wrong. if user prefers italian english, prefers french both, ui should in italian.

php - Jquery script only targeting first prepended element -

why following script targeting first element jquery: $(document).ready(function () { $(".edit_post_tab").click(function () { var utility_id = $(this).attr("rel"); $(this).siblings("#post_utilities" + utility_id).toggle(); }); }); html/php:(the following receieved through page) <div class="edit_post_tab" rel="'.$rand_id.'"></div> <div class="post_utilities" id="post_utilities'.$rand_id.'" style="display:none;"> <div class="post_utilities-arrow"></div> <div class="post_utilities-window"> <div id="post_utility" class="tab1-post" rel="'.$rand_id.'">edit post</div> <div id="post_utility" class="tab2-post" rel="'.$rand_id.'">delete post</div> </div> </div> my questi

Android - SQLite Database - App update -

so got sqlite database (version 7) stores data app (version 1.0) , want fix few bugs (that have nothing database). happens if update app version 1.1? data deleted? or deleted if update databse version 8? (my onupgrade in databasehandler delete existing databse , create new 1 way) upgrading app not database. old data files kept intact. changing version number in code sqliteopenhelper cause onupgrade() called if version number in database file lower. doesn't delete anything, if delete data (as say), lost. see also: when sqliteopenhelper oncreate() / onupgrade() run?

php - WP 2 loops. 1st Sticky Posts, 2nd Non Sticky Posts -

i'll start saying i'm terrible @ php. can modify simple codes have no clue i'm doing when have write own. the goal: display 2 loops on wordpress index.php page 1 specific category. first loop should display sticky post, second other posts. the category display '28'. i have found page: http://codex.wordpress.org/sticky_posts don't know how put in action. i have spend hours try , work without success. so loop 1 should this: --- cat 28 show post id35. loop 2 should this: --- cat 28 show non sticky posts (so exclude stickies) if me i'd happy. it's been 2 days , still can't >.> thanks! get latest sticky post. <?php $sticky = get_option( ‘sticky_posts’ ); query_posts( array( ‘cat’ => 28, ‘post__in’ => $sticky, ‘orderby’ => id, ‘showposts’ => 2 ) ); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”permanent l

How do you implement a timer a LiveCode? -

i'm making pairs game. users can click , match pairs working great. however, i'd add timer. i'm not sure how this. i have button "start" used start , reset game. i've added field "counter" i'll use display time. i'm not sure how make timer work without blocking game play. considering game expect you're wanting display seconds , end game after period of time. livecode has great syntax this. 'send' command lets send messages in designated amount of time. example: send "handlername" target in 1 second so applying principle allows create timers in couple of lines of script local sseconds on countseconds add 1 sseconds send "timerincrease" me in 1 second end countseconds this example count forever might not useful! you described simple game imagine want count down 60 seconds 0. when hit 0, tell user time up.t in button try following script local sgameseconds local stimerrunning on

servicebus - Temporarily hiding a message in azure service bus queue/topic -

i have scenario of messages depend no completion of messages completed. there precondition set of messages processed message should processed first. precondition message long running process can take 30 minutes process. what hide message lets 5 minutes subscribers when sense precondition not complete , after 5 minutes available again , hidden next 5 minutes if cant processed , on. i can see can use sessions , defer solution not want go way. since require maintain storage keep defered messages in non queue storage. another way peak lock on message , leave alone , let lock expire in due time reappear in queue. is there better way of doing this? there couple ways achieve this. when message can choose defer it. remove active queue , have later ask message messageid. scenario may possible use scheduled messages (see below) involve receiving message , scheduling 1 using following: http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.brokere

powershell - SharePoint - document libraries, lists, views and number of elements -

i have lot of documents want store in document library in sharepoint 2010. we're talking 50k+ documents. i've worked document libraries many times, not of size , find myself getting confused definitions when comes how these should stored , number of elements allowed. by looking here: http://technet.microsoft.com/en-us/library/cc262787%28v=office.14%29.aspx#listlibrary says document library can hold 30 million documents. nice! 50k not close 30 millions. however, can dump of documents library without grouping them in views or sub folders? cause view can have 5k elements , have create views , put documents in many views in order not exceed limit. now, documents, , library, never browsed going library. each document linked place, , not often. therefore kind of hoping can dump documents in 1 big library. have read if number of elements in list exceeds 5k sharepoint not query query return everything, instead exchange query default query. in case fine, there other concerns du

Overwrite an excel workbook when it is opened -VBA code -

is there way overwrite excel file when opened using vba code? i think can't overwrite file open. windows limitation , far know not possible it. so guess you'll have save different name. edit: unless person has file open. if open file via vba code, workbookname.save should work

C# Excel add-in worksheet error 0x800A03EC - unrequested cell movement -

alrighty guys have rather brain mangler you; i'm trying develop relatively simple add-in excel should read in data sheet in workbook, create new or update sheet b contain simplified version of said data in sheet @ press of button. below example code i'm working on: application.sendkeys("{enter}"); // exit edit mode excel.workbook wb = this.application.activeworkbook; excel.worksheet sheeta = null; excel.worksheet sheetb = null; foreach (excel.worksheet sheet in wb.worksheets) { // assume origin sheet want move same name book name if (sheet.name == wb.name) sheeta = sheet; // sheet move called review. clean if exists. else if (sheet.name == "review") { sheetb = sheet; sheetb.cells.clearcontents(); } } // if origin sheet cannot found, assume it's first sheet if (sheeta == null) sheeta = (excel.worksheet)wb.worksheets[1]; // add review sheet after origin sheet if doesn't exist if (sheetb == n

mysql:Get data at particular time -

need suggestion finding list of users status=1 @ 31 jan 23:59:59(end of month). select count(*) users status=1 , created_at=? one way restore database previous time reverse running binlog current database state. or start database schema , running statement binlog related table only. take of slave, if still on previous state

JAVA Robot mouse event not working on login screen of oSX mavericks but works on lower version -

i run java application in login window using launchagents ,which captures mouse , keyboard events remotely , executes it. keyboard events work not mouse events. <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>com.ash.login</string> <key>limitloadtosessiontype</key> <string>loginwindow</string> <key>runatload</key> <true/> <key>program</key> <string>/usr/bin/java</string> <key>programarguments</key> <array> <string>/usr/bin/java</string> <string>-jar</string> <string>-dapple.awt.uielement=true</string> (works without option) <string>/library/ash

java - How to modify a Jlabel using a different class? -

hello wonder how create class modifies consisting jlabel ( placed in class). able choose jlabels color, size , on , use class in 1 containing jlabels. how started : http://pastebin.com/xujjrjzk ; any appreciated! create 1 class applicationmanager. create 1 jlabel jlabel1. create setter , getter method jlabel. call setter method original class constructor. and call getter method want.it return reference of original jlabel,you can call settext or other method getter method return jlabel.

how can i modify a text file by perl -

i want make 'find/change' function. open original file. change words through using s/ / / or tr/ / / it's not working, think. open(txt, ">>text.txt"); $str = <txt>; $str =~ s/'a'/'b'/; print txt $str; look @ example: ... open rh, "text.txt" or die $!; chomp(my @lines = <rh>); close rh; open wh, ">text.txt" or die $!; foreach $line (@lines) { $line =~ s/'a'/'b'/; print wh "$line\n"; } close wh; ...

Powershell - Suppress errors witihn a function (Out-Null) how to get it working -

ive found useful powershell script on site function counting files/folder sizes. im using because fast , low memory use large files/folders. the problems when encounters folder doesn't have access output console saying access denied. exception calling "getfiles" "0" argument(s): "access path 'c:\users\administrator\appdata\local\applicati\ n data' denied." @ line:4 char:37 + foreach ($f in $dir.getfiles <<<< ()) + categoryinfo : notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid : dotnetmethodexception i know, or think need use |out-null suppress errors, still have script work, cannot figure out or how this, despite multiple attempts. so heres script if has ideas? function get-hugedirstats ($directory) { function go($dir, $stats) { foreach ($f in $dir.getfiles()) { $stats.count++ $stats.size += $f.length }

Xcode 5 cannot run using selected device on iOS simulator -

so seems quite common question answers found related getting "xcode cannot run using selected device" when trying run on connected device. issue getting error trying run in ios simulator. some background app running in simulator fine, , changed project name, target name , scheme name , when problems started occur. i tried many of different solutions in of other threads such as: clean, delete derived data, restart xcode, restart computer, make sure using default llvm, remove info.plist re-add project again. none of them worked. i discovered problem , able working , post solution below. what discovered problem, in info.plist file executable file (cfbundleexecutable) hard coded "myappname". when changed project name , target name , scheme name, hardcoded value not changed, still had original app name in it. so changed executable file (cfbundleexecutable) in info.plist file constant: ${executable_name} and problem solved :) edit: i had p

actionscript 3 - Flex - DateField change event -

i using datefield editable 1 in application. , did change event filter function. want same function each keystroke. tried valuecommit. it's did nothing. questions are: is there event 1 can use when changes actual value in datefield's textinput control? how use textinput normal textfield component? thank you. you can use keyup event. rised every time when release pressed button in textfield. think make trick. <mx:datefield keyup="datefield1_keyuphandler(event)" editable="true"/>

php - MySQL query with multiple 'OR' statements -

i have query, have tested outside of php directly on sql , still getting same problem the idea being $currentartist sent through using method, value matches value in event_artist columns information displayed. select * `".dbn."`.`events` `event_artist1` or `event_artist2` or `event_artist3` = '".$currentartist."' "; the problem have is ignoring where part of query. returns complete table results , not results match $currentartist . i have tested $currentartist , works fine. i'm @ loss how complete statement work. i've tried surrounding or statements in brackets in: (`event_artist1` or `event_artist2`...) = '".$currentartist."' this returns result if $currentartist equal "1" being first person in artists table information stored. any appreciated. select * events e '$currentartist' in (e.event_artist1,e.event_artist2,e

python - Techniques for condensing code -

as understand it, python designed force people use indentation possible break rule. example: y=[1,2,3] print('listy:') x in y: print(x) now, can condense last 2 lines such: for x in y:print(x) but cannot do: print('listy');for x in y:print(x) but there way can? first of all, should agree such tricks may of use. not often, though. example code in doctests. clear enough readable when compacted, , making compact makes less problems making "as readable possible". however, regular code joining lines not practice. when not able create breakpoint inside if or for statement, it's bigger problem line. coverage tools give more information in case not practice such tricks. however, answering question, seems there no way want. there many limitations in using ; . compound statements can not used ; . these limitations reasonable, regret strict. upd: if focused on making one-liner, there lot of tricks. example, generators ,

wordpress - Display a banner if custom field is true -

i got following code display banner on repro: <div> <div id="publicidad-video"> <iframe frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="300" height="250" src="su publicidad"></iframe> <br> <div style="float: left; left: 180px; position: relative; top: -210px; z-index: 9999;"> <span class="jbtn" onmouseover="jquery(this).hide('fast');jquery('#asd1').show('slow')">cerrar</span> </div> <div id="asd1" style="display: none; float: left; position: relative; top: -65px; z-index: 9999;"> <span class="jbtn" onclick="jquery(this).parent().parent().remove();">cerrar</span> </div> </div> <?php $values = get_post_custom_values("video"); echo $values[0]; ?> </div> i got custom

python - Can a "with" statement be used conditionally? -

i have python function of following structure, computes results , writes them file: results = [] open(filename, "w") output: item in items: result = compute_stuff(item) write_result(item, result, output) results.append(result) return results now don't want write results file - want compute them , have them returned. making "write_result" conditional easy, there way make file creation in "with" statement condition-dependent? (i know handle opening , closing of file explicitly, incur "try/finally" overhead "with" statement created avoid.) is there elegant solution this? edited add: may have oversimplified example. instead of writing arbitrary file, i'm using matplotlib.backends.backend_pdf.pdfpages ( link ), , adding plot (new page in pdf) in every step. in particular, means cannot re-open pdf file pdfpages , because overwritten. you can write own context manager function: class

How to hash strings of chars and integers in hash table -

i trying hash strings names containing 2 letters , 4 digit. example names (strings): az5466 ge1890 ru0291 and save them in hash table. i thought if there way refer string integer number, can make: (name % 10) - example , hash them in array size 10 of linked lists. using c language. you can convert each character ascii code , multiply. for example, in case, can write like: int number = ((name[0] - 'a') * ('z' - 'a' + 1) + (name[1] - 'a')) * 10000 + atoi(name + 2); the code assumes letters capital. by way, should check if converting integer , modulo enough (you need make sure you'll have approximatelly same number of elements in each bucket). if want, can split them more first or letter: hash = (name[0] - 'a') will give number between 0 , 25 (according first letter), and hash = (name[5] - '0') will give same results converting integer (the way i've suggested) , perform modulo 10.