Posts

Showing posts from August, 2014

python - Django attribute assignment, understanding the documentation -

i see django doc : models.decimalfield(..., max_digits=5, decimal_places=2) can explain dose ..., mean in attributes assignment? it means arguments have in call. you can think of "in addition to" . all django model fields have common options , passed in key/value pairs constructor. these in addition to those: " in addition other arguments, add these arguments store numbers 999 resolution of 2 decimal places."

javascript - Can anyone explain the difference between these two regular expressions? -

/^[a-za-z]+$/ vs /[^a-za-z]+$/ the ^ @ start of expression means "anchor @ beginning of string". the ^ inside character class [] expression means negate . so /^[a-za-z]$/ matches string consists entirely (from beginning end) of upper case , lower case alphabetic characters, while /[^a-za-z]$/ matches "end of string not consist of alphabetic characters" (for example, numbers @ end of string). this string -- matches neither (contains non alphabetic, doesn't end in it) number: 123 -- second expression matches ': 123' (string ends in non-alphabetic characters) -- first expression matches 'this' (string contains alphabetic characters)

html - Angular File Upload Nested Dropzones -

using library angular file upload i'm trying make nested dropzones running issue dragleave events. <div class="full-area"> <div class="outer-dropzone"> <ol> <li> <div class="container"> <div class="drop-zone-inner"></div> <div class="align"> </div> <div class="align"> </div> </div> </li> </ol> </div> </div> what want achieve along lines of follow: when dragging browser window , .outer-dropzone entered changes css (background color yellow example). if drag onto .drop-zone-inner reverts .outer-dropzone changes drop-zone-inner new css background. third if leave .drop-zone-inner re-applies .outer-dropzone css change. the issue i'm having if have several items in .drop-zone-inner field (i.e text , image etc). causes flashing in tries unapply

ios - UITextview shows text Arabic but numbers English -

i want show arabic text , number of uislider value in uitextview example: مقدار= ۴۰ i using code: self.mytextview.text= [nsstring stringwithformat:@"%f", self.myslider.value]; uitextview shows arabic text correct value adding english characters. how can concatenate slider value uitextview show them arabic characters too. you should use nsnumberformatter . nsnumberformatter* formatter = [nsnumberformatter new]; [formatter setlocale:[[nslocale alloc] initwithlocaleidentifier:@"ar"]]; textview.text = [formatter stringfromnumber: @(slider.value)];

What does this pointer-heavy C code do? -

could explain me should 2 following lines do: s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata; ++((char *)uip_appdata); this taken uip code microcontrollers. s - structure httpheaderline - http packet presented string httpheadrlineptr - integer value uip_appdata - received ethernet packet (string) if more info needed please let me know. btw. eclipse reporting error on second line message invalid lvalue in increment i'm trying figure out how solve this. the intention behind first line grab character pointed uip_appdata : *(char *)uip_appdata casts uip_appdata char* , dereferences it, taking first character. the second line tries increment uip_appdata . trouble is, not properly, because results of cast cannot incremented "in place". here 1 way of doing works: char *tmp = uip_appdata; uip_appdata = ++tmp; with code fragment compiler can take care of converting between pointer types in cases when platform requires it. her

c# - http add sslcert fails when done programatically -

i have developed self-hosted api. the api traffic needs run on ssl. using combination of netsh commands have managed add certificate , bind route service. happy days. but, have write installer programmatically. the problem when add certificate using c# code, can see certificate mmc when try bind error of: ssl certificate add failed, error: 1312 specified log-on session not exist. may have been terminated. as say, when manually these steps don't problem... list item double click on .pfx file. mmc opens. i select "local machine" on next screen confirm .pfx file location , name. i enter password certificate , select "include extended properties" on next screen let default "automatically select certificate store based on type of certificate" i confirmation screen. when click "finish" message "the import successful" i can see in mmc under personal > certificates and lets me add route using netsh comman

input - Read two characters consecutively using scanf() in C -

i trying input 2 characters user t number of times. here code : int main() { int t; scanf("%d",&t); char a,b; for(i=0; i<t; i++) { printf("enter a: "); scanf("%c",&a); printf("enter b:"); scanf("%c",&b); } return 0; } strangely output first time is: enter a: enter b: that is, code doesn't wait value of a . the problem scanf("%d", &t) leaves newline in input buffer, consumed scanf("%c", &a) (and hence a assigned newline character). have consume newline getchar(); . another approach add space in scanf() format specifier ignore leading whitespace characters (this includes newline). example: for(i=0; i<t; i++) { printf("enter a: "); scanf(" %c",&a); printf("enter b: "); scanf(" %c",&b); } if prefer using getchar() consume newlines

image - Export part of the view in NetLogo -

Image
i want to, given list of turtles, export part of view contains turtles image. being able export part of view specified set of boundaries solve problem. is, function export-view-of-turtles list-of-turtles or export-view-rectangle min-xcor max-xcor min-ycor max-ycor ideal. obviously, solution works entirely in netlogo best, find unlikely: export-view function know of exports image of view @ all, , whole view. however, if there's plugin this, awesome. my last resort export view , run script clips accordingly. if there isn't better solution, i'll this, , post script. alright, kind of dirty, seems work. basically, below exports world state in temp file, records data turtles in question, resizes view based on distance of turtles center, recreates turtles recorded data, exports view, restores original world state. here's code: to export-view-of-turtles [ filename the-turtles ] let center-patch min-one-of patches [ sum [ (distance myself ^ 2) ] of the-tu

android - SeekBar in ListView Item is reset -

in application have listview custom item view. each item has own seekbar holds age different persons displayed in listview. problem can scroll seekbar each person if item scrolled out , came in next time seekbar reseted 0. customadapter looks this: public view getview(int position, view convertview, viewgroup parent) { view row = convertview; peopleholder holder = null; if(row == null) { layoutinflater inflater = layoutinflater.from(context); row = inflater.inflate(layoutresourceid, parent, false); holder = new peopleholder(); final textview tvage = (textview) row.findviewbyid(r.id.age); tvnote.settag(position); holder.age = (seekbar) row.findviewbyid(r.id.agekbar); holder.age.setonseekbarchangelistener(new onseekbarchangelistener() { @override public void onstoptrackingtouch(seekbar seekbar){ } @override public void onstarttrackingtouch(seekbar

ios - View loaded from nib not resizing correctly when embedded in container view -

Image
i have couple of view controllers/views complex nibs reuse in different projects. attempting building container view controller in new project , embedding view controller in container. view being loaded nib in project. although original project more complex, have built sample project illustrate problems having. sample project has classes , files described below 1) csmsketchview (.h , .m) -- allows user draw on screen 2) csmsketchviewcontroller (.h , .m) -- used control sketch view , manage undo/redo/clear buttons. 3) csmsketchviewcontroller.xib -- contains layout information sketch view in xib file, undo/redo/clear buttons placed in container view empty spacer views between them shown below. orange , yellow boxes spacer views , blue on right end of container view. have added buttons on left, right , bottom of xib. there autolayout constraints keeping these buttons centered , 20 away edge of view. there autolayout constraints pinning line of buttons , views in contai

actionscript 3 - How do you obfuscate APK or protect APK for Android that is published with Flash Pro CC ? -

i created application android smartphones using flash pro cc. i don't know obfuscating apk files heard apk can decompiled , therefore file sourcecode vulnerable. started searching on google , found proguard obfuscation. it's eclipse guess can't use proguard app created using flash pro cc. there way obfuscate apk? or there other way protect apk? obfuscate swf file , recompile apk. can obfuscate as3 using: http://www.kindi.com/ , http://www.amayeta.com/software/swfencrypt/ .... or others. note these tools might cause performance issues , errors sure test final version.

swift - Force a generic type parameter to be a class type? -

i'm trying figure out method avoiding retain cycles when references in cycle held in collections. idea create wrapper struct : struct weak<t> { unowned let value: t init(_ value: t) { self.value = value } } the issue here unowned , weak members have of class type ( main.swift:3:17: 'unowned' cannot applied non-class type 't'; consider adding class bound ), there's no reasonable superclass me require t inherit from. is there way force t of class type without inheriting specific other class? try: struct weak<t:anyobject>

Proper way of passing array parameters to D functions -

1st question: are d array function parameters passed reference, or value? also, language implements copy on write arrays? e.g.: void foo(int[] arr) { // arr local copy or ref external array? arr[0] = 42; // how now? } 2nd question: suppose have large array passed function foo read-only parameter , should avoided as possible copying array, since assumed large object. following (or none of them) best declaration function foo : void foo(const int[] bigarray) void foo(in int[] bigarray) void foo(const ref int[] bigarray) technically, dynamic array int[] pointer , length. pointer , length copied onto stack, not array contents. arr[0] = 42; modify original array. on other side, static array int[30] plain old data type consisting of 30 consecutive int s in memory. so, function void foo(int[30] arr) copy 120 bytes onto stack start. in such case, arr[0] = 42; modifies local copy of array. according above, each of ways listed avoids copying array

codeigniter - insert method is overwriting what is in the cart and not adding to it -

if($this->input->post('tambah')){ $kode = $this->input->post('kode'); $jumlah = $this->input->post('jumlah'); $hjual = $this->input->post('hjual'); $nama = $this->input->post('nama'); $exp = $this->input->post('tglexp'); $hpp = $this->input->post('hpp'); $temp_stok = $this->input->post('temp_stok'); $diskon = $this->input->post('diskon'); $cart = array( 'id' => $kode, 'qty' => $jumlah, 'price' => $hjual, 'name' => $nama, 'options' => array('exp' => $exp, 'hpp' => $hpp, 'temp_stok' => $temp_stok , 'diskon'=>$diskon )); $this->cart->insert($cart); header('location:'.base_url().'penjualan/load_input_barang_eceran'); } i cant seem add mor

javascript - Saving an Incremental Game Locally -

i'm trying incremental game save cookies/data locally, not sure how it.. here's html , javascript. javascript: savegame() = function() { saveservice.savegame(); } resetgame() = function() { localstorage.clear(); } html: <section><center> <p>the game auto-saves every 30 seconds, in case in hurry, use this:</p><br /> <a class="button12" ng-click="savegame()"/>save game</a> <br /><br /> </center></section> <hr> <section><center> <p>this <strong>permanently</strong> reset game (refresh after press it):</p><br /> <a class="button12" ng-click="resetgame()">reset game</a>

spam prevention - Nginx block from referrer -

i need block http connections, have referrer click2dad.net. write in mysite.conf: location / { valid_referers ~.*http://click2dad\.net.*; if ($invalid_referer = ''){ return 403; } try_files $uri $uri/ /index.php?$args; } but still see in nginx logs: http/1.1" 200 26984 "http://click2dad.net/view/vuhfce4ugtsb0sokerhgmvpxcmxszu" 200, not 403 as correct block clients click2dad.net ? it should noted expression matched against text starting after “http://” or “https://” http://nginx.org/en/docs/http/ngx_http_referer_module.html correct config: location / { valid_referers click2dad.net*; if ($invalid_referer = ''){ return 403; } try_files $uri $uri/ /index.php?$args; }

node.js - Node JS + Mongoose: saving documents inside while() -

i playing around node , mongoose , curious following issue: i trying save documents mongo within loop / interval. the following works fine: setinterval(function(){ var doc = new mymodel({ name: 'test' }); doc.save(function (err, doc){ if (err) return console.error(err); doc.speak(); }); }, 1); the following not work: while(true){ var doc = new mymodel({ name: 'test' }); doc.save(function (err, doc){ if (err) return console.error(err); doc.speak(); }); } what explanation behavior? save callback never firing in scenario 2 additionally, can comment on best practices building "long running workers"? interested in using node build background workers process queues of data. while() bad idea? setinterval()? additionally, plan use forever module keep process alive thanks! node.js single threaded while(true) occupy single thread, never giving doc.save callback chance run. the

Is it possible to use multiple trailing closures in swift? -

i know possible define methods accept closures this: a. single closure input parameter func testofclosures (flag: int, closure1: () -> ()) { closure1() } b. multiple closures input parameters func testofclosures (flag: int, closure1: () -> (), closure2: () -> (), closure3: () -> ()) { switch flag { case 1: closure1() case 2: closure2() default: closure3() } } interestingly in first case can invoke this: testofclosures(1){ println("print closure 1") } but in second case, cannot invoke this: testofclosures(1,{ println("print closure 1") }, { println("print closure 2") }) { println("print closure 3") } and have invoke this: testofclosures(1,{ println("print closure 1") }, { println("print closure 2") }, { println("print closure 3") }) any reasons? it looks trailing c

Javascript onload after redirect -

in javascript code loading page, , perform functions. tried use solutions window.onload , after html (blank page js) loads, need function perform after page reffering loaded. using code: this.document.location.href = myurl; and after loads, call function. there way so? thanks edit: i can not edit target page source code. when change value of document.location.href , doing redirect. you can either whatever want within loaded page or if don't have cross domain issues, xhr of page you're wanting load dynamically, query body, replace content of current body , replace head contents i.e. style, title , scripts etc. execute script want. extra note: quite tricky thing do, i've done few times before - , proven quite problematic due fact don't parsed document object can query simply, receive huge string. 1 hack i've thought of using loading within iframe allowing easy querying documented - reading here

Android downsample bitmap vs different bitmap sizes -

i reading on developing on android (beginner) through website , wondering if there difference between following 2 options , trade offs, if going in correct direction. the following url explains how can "downsample" image fit smaller. https://developer.android.com/training/displaying-bitmaps/load-bitmap.html in section, explains how have different sized bitmaps different screen of different densities. https://developer.android.com/training/basics/supporting-devices/screens.html my question whats difference if choose first approach, have big bitmap , downsample according screen density, (perhaps resulting in more computational power, less battery life) , second approach, have several bitmaps of different sizes.

ios - NSURL download file, indicators shows too late -

hi got following code , want show activityindicator while downloading. indicator shows when download has finished? _fandownloadindicator.hidden = no; nslog(@"batzn"); nsstring *documentpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes)objectatindex:0]; nsstring *file = [documentpath stringbyappendingpathcomponent:@"fan_new.mp3"]; bool fileexists = [[nsfilemanager defaultmanager]fileexistsatpath:file]; if(fileexists == no) { nsurl *downurl = [nsurl urlwithstring:url]; nsdata *data = [nsdata datawithcontentsofurl:downurl]; if ([data writetofile:file atomically:yes]) { nslog(@"downloaded fan"); issue you doing download task on main thread, , wait until thread ends before show loading view. solution you need start downloading task on background thread using dispatch_async. check out code below _fandownloadindicator.hidden = no; nslog(@"batzn"); nsstring *documentpath =

string - Compare word to Text file Java -

we supposed create program reads word jtextfield , compare list, have count how many lines word if exist , display same line text file in same program jtextfield (it's supposed dictionary of sort) here have: boton1.addactionlistener(new actionlistener(){ @override public void actionperformed(actionevent e) { string palabra=tx1.gettext(); boton3.setenabled(true); try{ // here open file fileinputstream fstream = new fileinputstream("src/archivos/translator.txt"); datainputstream entrada = new datainputstream(fstream); bufferedreader buffer = new bufferedreader(new inputstreamreader(entrada)); string strlinea; while ((strlinea = buffer.readline()) != null) { system.out.println (strlinea); int i=0; while (!(strlinea.equals(palabra))){ i++; } tx2.settext(string.valueof(i)); } entrada.close(); }catch (ioexception x){ system.err.println("oh n

python - Extend set to make custom set -

this new question because question . i want extend set make custom set of file names in folder: class filesset(set): def __init__(self, in_dir = none): set.__init__(self, ()) self.in_dir = '' self.files = set() if in_dir: self.in_dir = in_dir self.files = set(map(os.path.basename, glob.glob(self.in_dir + "/*.txt"))) def __contains__(self, item): return item in self.files def __len__(self): return len(self.files) def __iter__(self): return iter(self.files) when try it: f1 = filesset(in_dir = indir1) f2 = filesset(in_dir = indir2) c1 = f1 | f2 c2 = f1 & f2 print(c1, c2) c1 , c2 empty. why? should overwrite other methods set? link think need define contains , len , iter . other methods or (), sub (), xor () performance only, understand.

f# - How to iterate over an Enum, and cast the obj -

how enumerate enum/type in f# tells how enumerator .net enum type in f#: use: enum.getvalues(typeof<mytype>) however, when put use found limitation. can work around limitation, looking better way. the problem solution returns .net array of objects, use need cast it, , casting unwieldy iteration. type colors = | red = 0 | blue = 1 | green = 2 // typed function, show 'obj' in real use let isfavorite color = color = colors.green // iterate on enum (colors) color in enum.getvalues(typeof<colors>) printfn "color %a. favorite -> %b" color (isfavorite color) // <-- need cast the (isfavorite color) raises type conflict between colors (expected) , obj (actual) this fixed: for obj in enum.getvalues(typeof<colors>) printfn "color %a. favorite -> %b" obj (isfavorite (unbox<colors> obj)) but, if 1 needs (unbox<colors> obj) in several places? a local let color = ... suffice, but, ideally, use en

python - Django index page shows ViewDoesNotExist at / Could not import mysite.views.home. Parent module mysite.views does not exist -

i new django.. when working before 2 days..it working properly.. django index page shows .. viewdoesnotexist @ / could not import mysite.views.home. parent module mysite.views not exist. url.py contain url(r'^$', 'mysite.views.home', name='home'), please me. did mistake?? seems mistake in views.py. add home view code?

mysql - Import csv into phpmyadmin and skip first colum -

since i'm not db geek need import csv dump db. i have db looks this: http://i.stack.imgur.com/f6ms4.png i need import csv dump looks this: br,dc634e2072827fe0b5be9a2063390544 bs,7c9df801238abe28cae2675fd3166a1a bt,6920626369b1f05844f5e3d6f93b5f6e how can skip first colum , import combination , hash? http://i.imgur.com/g1pu2zt.png thanks! while importing through phpmyadmin, mention column names comma seperated before go button

sql - Type Mismatch error in Initialization form code calling an Access data table -

i encountering issue in project seems have occurred without code alteration. background, project got corrupted consequently redid entire project in workbook work around corruption. i'm concerned i'm facing same problem again not. my program throwing following error when prompted pull first forms require connection access data table: "run-time error -2147352571 (80020005): type mismatch". instead of highlighting specific line of code in initialization portion of form, vb highlighted line of code form called out. i'm confident issue in section based on previous issues i've had form code. below code believe i'm having issue: private sub userform_initialize() call setconnection 'modify [week] data type connection.execute "alter table raw_data alter column [week] date;" 'define recordset set recordset = new adodb.recordset recordset .open "select distinct [week] raw_data;", connection, ado

chart.js - Charts.js -> Display / Load chart only when visible on the screen -

this first question, searching answer here , on google no avail. i preparing website accountancy company, have requested demo created data visualisations. have opted use 'charts.js'. my problem this, want chart load when visible on screen. @ moment load @ same time therefore miss quite nice animation. extending on question, text next chart 'ease-in' too, when visible on screen. would kind enough point me right material on 'net, or maybe show me easy way achieve this? kindest regards , thank in advance! as requested, adding simple code displays 2 charts below screen. make work need chart.js here: chart.js website index.html: <!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>graphs</title> <link rel="stylesheet" href="css/main.css"&g

erlang - Error on creating a Map -

i reading doc of elixir , executing related codes, fine until part http://elixir-lang.org/getting_started/7.html . part says: iex> map = %{:a => 1, 2 => :b} %{2 => :b, :a => 1} iex> map[:a] 1 iex> map[2] :b but if same in laptop error: iex(1)> map = %{:a => 1, 2 => :b} ** (syntaxerror) iex:1: invalid token: %{:a => 1, 2 => :b} what doing wrong?? idea? elixir version: elixir 0.10.3 erlang version: rlang/otp 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] you have outdated elixir version on laptop (0.10.3). maps introduced in version 0.13.0

ios - UIDynamics not working in Swift -

i'm attempting convert ray wenderlich's tutorial on uidynamics swift code, i'm stuck on first part. http://www.raywenderlich.com/50197/uikit-dynamics-tutorial here's i'm doing: created square uiview added uidynamicanimator main view added uigravitybehavior , initialized square added gravity behavior animator it compiles , runs fine square doesn't move. can see i'm doing wrong? https://github.com/oisinlavery/uidynamics-swift you've created animator local variable go method, disappears method finished. needs instance variable on viewcontroller class stick around , work of animating square: class viewcontroller: uiviewcontroller { var animator: uidynamicanimator? @ibaction func go(sender : uibutton) { var square = uiview(frame: cgrectmake(100, 100, 100, 100)) square.backgroundcolor = uicolor.blackcolor() self.view.addsubview(square) self.animator = uidynamicanimator(referenceview: sel

python - Make a loop go back to the begining of a list -

i’m making cross reference program in python. have list of 600 data points, , of 148 data points. want cross reference 2 find similar points within specific range. know have loop through 1 list, find range met, loop stop when finished list. how make go top of list once has reached end? for idx in hectora: matches = np.where(abs(hectora[idx] - ra) < .01) print idx hectora list 600 points; ra list 148 points. want able loop through either one. using for statement on list start beginning of list each time start loop. hence, every for item in mylist: # item. will loop on mylist beginning.

c# - Breaking cumulative transformations -

i using drawingcontext object draw series of rectangles. requirement this: first rectangle want place at(100, 100) second rectangle want place at(200, 200) third rectangle want place at(0, 0) i using transformation matrix achieve follows: to position first rectangle @ (100, 100) use following: drawingcontext.pushtransform(new translatetransform(100, 100)); drawingcontext.drawrectangle(brushes.blue, null, new rect(0, 0, 100, 100)); to position second rectangle @ (200, 200) use following: drawingcontext.pushtransform(new translatetransform(100, 100)); drawingcontext.drawrectangle(brushes.blue, null, new rect(0, 0, 100, 100)); to position third rectangle @ (0, 0) can use (-200, -200). curious there way can replace cumulative chain , overwrite entire matrix new position like: drawingcontext.pushtransform(new translatetransform(0, 0)); this possible on winforms graphics setting transform property follows: g.transform = new matrix(); is there way in can break cumu

mysql - Backend technology for high volume data for web application -

i developing application provide daily dynamic information prices, availability, etc around 50,000 objects. need store data next 200 days. mean total of 10 million rows. prices batch updated , new data added once daily. let me 10,000 existing rows updated , 50,000 rows inserted daily. best backend framework can use. can mysql scalable limited hardware capability. or nosql database way go? if yes, nosql database best suited fast fetching , updating data. i recommend use cassandra, need write more read, , cassandra optimized high throughput while write. provide scalability, no single point failure , high throughput. , can update records well. cassandra supports batch operation dml (data manipulation language) i.e. write, update , delete. , batch operation of cassandra provides atomicity well.

javascript - Token Error while using Node Server SDK Opentok -

i using opentok node sdk version 2.2.2 (installing via npm) & client side plugin version 2.2.5.1 . during session.connect() method call , error : ot.exception :: title: authentication error (1004) msg: invalid token. make sure you're using latest opentok server sdk . when decoded token(base64) , got : partner_id=23690372&sig=f52e13ac579649a3531a6040e679fb9bcca04007:session_id=1_mx4ymzy5mdm3mn5-rnjpiep1biawniaxmdoynjoymybqrfqgmjaxnh4xljqzmduxmtvfltz-fg&create_time=1402075583&nonce=0.7174300465267152&role=publisher&expire_time=1402161983 my session id matches 1 above . using methods , opentok.createsession(function(err, session) { } ) , opentok.generatetoken(session.sessionid) generate session id , token on server end . on client side , doing : session = tb.initsession(tok_api_key,session_id); session.on("streamcreated", function(event) { session.subscribe(event.stream); }); var publisher = tb.initpublisher(&quo

android - Horizontal Align elements inside a ViewPager -

Image
so problem following... have relativelayout has 3 main elements. column 2 buttons on left, on right , scrollview layout on center contains viewpager , button. the button aligns fine it's parent. can not viewpager align itself. here xml layout. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <linearlayout android:id="@+id/leftbuttons" android:weightsum="1" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginleft="10dip" android:orientation="vertical" android:layout_alignparentstart="true" > <space android:layout_weight="0.5" android:layout_width="match_parent" android:layout_height="0dip&quo

php - AJAX pagination w/ MySQL database subset -

i have page uses mysql & meekrodb pull info database. results limited 15 per page & alphanumeric subset of database - in example, 1-3 & a-b i want add pagination when click either #goleft or #gort, pull correct items database. how call ajax call pagination.php & pass variable $start it? not sure everything, please correct if have in wrong place. not sure if $start,15 correct in pagination.php i've gotten far: main page: <?php require_once 'meekrodb.2.2.class.php'; require_once 'dconnect.php'; // database login info // pulling $results database on initial pg load $results = db::query("select substr(theme, 1, 1) alphabet, theme, developer, thumb, thumb_lg gallery order (case alphabet when '1' 1 when '2' 2 when '3' 3 when 'a' 4 when 'b' 5 else 6 end), theme limit 15"); // count of relevant items $tcount = db::query("select substr(theme, 1, 1) alphabet, theme, dev

Android ListFragment in Tabs not showing on back button return -

i have (relatively) simple drill down application. it has 1 activity (mainactivity) contains , transitions fragments. public void gotopartnumbers(){ fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); ft.setcustomanimations(r.anim.slide_in_right, r.anim.slide_out_left, r.anim.slide_in_right, r.anim.slide_out_left); ft.replace(r.id.container, new identifierfragment()).addtobackstack("partnumber").commit(); } identifierfragment tab layout la http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ public class identifierfragment extends fragment implements actionbar.tablistener { private viewpager viewpager; private fragmentstatepageradapter madapter; private actionbar actionbar; private mainactivity mcontext; // tab titles private string[] tabs = { "part numbers", "oem numbers" }; public identifierfragment() { // required empty public constructor } @override public view oncreateview(l

famo.us - how to implement mobile design hamburger side menu with famous? -

what's best way famous implement these known mobile app design patterns? !) "hamburger" , side-menu like jasny example ? 2 )table-view, transitioning full-screen details page, little like: http://goratchet.com/examples/app-movies/ thanks! you should aware famo.us university timbre menu lesson available. here version did long before came out. more of 1 file here critical issues implementations 27 class version. following did produce abstraction of menu generalized tool. there little difference between menu below , standard (one level deep) menu exception of transitions use. here drag-to-uncover menu. of course trigger open and/or close click well... can see code , play live @ codefamo.us . /*globals define*/ define(function(require, exports, module) { 'use strict'; // import dependencies var engine = require('famous/core/engine'); var surface = require('famous/core/surface'); var transform = require('famous/core/tra

linux - Getting "make: Entering an unknown directory" error while building postgresql in a subsystem -

i trying install postgresql on mips platform , getting following error while building it. make[4]: leaving directory `/home/shreesha/platform/utils/postgresql-9.3.4/src/port' /home/shreesha/platform/tools/bin/make -c timezone make[4]: entering directory `/home/shreesha/platform/utils/postgresql-9.3.4/src/timezone' /home/shreesha/platform/tools/bin/make -c common **make: entering unknown directory** make: *** common: no such file or directory. stop. make: leaving unknown directory make[4]: *** [common-recursive] error 2 make[4]: leaving directory `/home/shreesha/platform/utils/postgresql-9.3.4/src/timezone' make[3]: *** [all-timezone-recurse] error 2 make[3]: leaving directory `/home/shreesha/platform/utils/postgresql-9.3.4/src' make[2]: *** [all-src-recurse] error 2 make[2]: leaving directory `/home/shreesha/platform/utils/postgresql-9.3.4' do need set specific make variables/environmental variables in case? on debugging appreciated!

sql server 2008 - How to set flag variable if year is changed in comparing two dates -

suppose example have start date 31-12-2013 & end date 6-01-2014. want set flag =1 in sql server database table if start date in previous year & end date in next year. how this? you can using computed column. example, have created table following script: create table tblcomputedsample (start_date datetime, end_date datetime, flag (case when year(end_date) - year(start_date) = 1 1 else 0 end) ) note column flag, automatically value based on values in start_date , end_date fields. insert values , check data. i inserted sample data: insert tblcomputedsample values('1-mar-2014','10-nov-2014'),('1-mar-2013','10-nov-2014'), ('1-mar-2014','10-nov-2015'),('10-may-2014','20-dec-2014') and checked value of flag.

How can i get android native java debuging codes with codenameone -

is there way or feature give possibility see native android codes after debugging project codenameone? right seeing .apk file project not android java source. want explore android java source , editing them. this useful debugging, converting using sources pointless mentioned in comments since c code generated ios not maintainable (its on 2000 files simple app). to use include source feature: http://www.codenameone.com/how-do-i---use-the-include-sources-feature-to-debug-the-native-code-on-iosandroid-etc.html

c# - OnMouseDown event, NullReferenceException: Object reference not set to an instance of an object -

im new unity3d c#. im trying make simple puzzle15 game. when click on each tile trying current tile coordinates , empty tile coordinates in order move current tile. tile objects instantiates in gameboard.cs class has move() method , trying run method onmousedown() method class tileparams.cs created store coordinates each tile. tileparams.cs attached tileprefab instantiate tiles from. i`ll not give of code, part getting error from. public class gameboard : monobehaviour { ... ... ... void instantiatetile(int tilenum, int x_coord, int y_coord) { settileposition (x_coord, y_coord); tileobject [tilenum] = instantiate (tileprefab, new vector3 (tile_x, tile_y, 0), tileprefab.transform.rotation) gameobject; tileobject [tilenum].transform.findchild ("tilenumber").gameobject.getcomponent<textmesh> ().text = tilenum.tostring(); tileobject [tilenum].getcomponent<tileparams> ().setx_coord (x_coord); tileobject [tilenum].getcomponent<tileparam

javascript - merge css and js in magento breaks website -

i want speed magento website. installed fooman speedster, not worked properly. have uninstalled it. i want achieve speed using default merge feature in magento. have enabled js merge, website not loading type of js files. i searched solution in google, found errors should removed js files. i getting errors " uncaught syntaxerror: unexpected token < " , "uncaught typeerror: cannot call method 'get' of undefined ". still struggling figure out errors can't. please 1 give instructions remove type of errors. in advance.

android - Linking two NumberPicker views with onValueChanged causes unpredictable crashes -

i've created dialog containing 2 numberpicker views. first contains list of groups, second contains items selected group: group group items 1 2: group 2 item 2 [2] [3: group 2 item 3] 3 4: group 2 item 4 i'm hooking in setonvaluechangedlistener in first numberpicker populate second numberpicker. mnumberpickergroup.setonvaluechangedlistener(new numberpicker.onvaluechangelistener() { @override public void onvaluechange(numberpicker numberpicker, int from, int to) { int size = mdata.getitemsforgroup(to).size(); string[] strings = mdata.getitemtitlesforgroup(to); mnumberpickeritems.setminvalue(1); mnumberpickeritems.setvalue(1); mnumberpickeritems.setmaxvalue(size); mnumberpickeritems.setdisplayedvalues(strings); } }); this works - until, in circumstances, changing group few times can cause crash in numberpicker class, when

.htaccess - htaccess redirect remove question mark from url -

i want remove question mark url , redirect same page without question mark. my url like: http://domain.com/what-is-your-name?/21.php url needed: http://domain.com/what-is-your-name/21.php this remove ? mark url rewritecond %{query_string} ^(.+)$ rewriterule ^(.*)$ $1%1? [r,l] put on first rule in .htaccess short explanation: rewritecond %{query_string} ^(.+)$ checks there query string (like ?foobar or ?foo=bar or ?/21.php ) in url, fill %1 variable. when rewritecond requirement if fullfiled, rewriterule ^(.*)$ rewrites url. $1 filled url part before ? mark. [r] flag indicates it's redirect. [l] means it's last rule. i recommend not this, , fixing links. you can either escape question marks in url's or remove completely.

R: variable name to string -

there simple solutions such as: > deparse(substitute(data)) [1] "data" but not quite work when want extract name list: > deparse(substitute(names(data)[1])) [1] "names(data)[1]" so problem want general solution every variable in list/data frame/numeric feed function. , want see names of variables column names output data frame. such as: foo <- function(...) { data <- list(...) ## magic here ## names(output_df) <- ?? output_df } and keep in mind numerics fed ... don't come names attribute. whole reason why want use environment name column name in output data frame. so apparently, "??" in question above should substituted with: setdiff(as.character(match.call(expand.dots=true)), as.character(match.call(expand.dots=false))) with expanded example: num_vec <- as.numeric(1:10) list1 <- 1:10 list2 <- 11:20 list_data <- list(list1, list2) df_data <- data.frame(list1, list2) foo

c - I2C Address format -

i'm working on writing/reading data across i2c usb i2c board umft201 . data sheet says default i2c address "22h". can't figure out means. when use general call address seems able write data board; think code working. i'm new c programming; not sure "22h" means. there trick understand ftdi umft201 , ft201x chip. it i2c slave chip. therefore not master, obvioulsy. means need micro-controller act i2c master plugged into umft201 slave. umft201 being plugged pc, can therefore implement i2c communication form micro-controller pc. micro-controller pc i2c slave address of 22h. you may want find evaluation board ftdi ft260 (c samples available) or device nusbio.net (c#, vb, powershell samples available) based on ftdi ft2301x both i2c master. this make i2c communication easier can talk pc i2c slave device. here sample talk i2c lcd screen c# or vb.net

php - submit button on hover isn't working -

i'm working on newsfeed , have while loop every posts styles, created an <input type="submit" name="deletepost" value="delete" class="delete_post" /> and styling isn't working... styling works :hover isn't working. nor :active , others. strange. css .image_post .user_avatar { width:32px; height:32px; overflow:hidden; border-radius:50%; } .image_post .user_avatar img { width:32px; min-height:32px; } .image_post .user_name { margin-top:7px; color:#fc0096; margin-left:-5px; } .image_post .timeago { color:#999; font-size:10px; position:absolute; top:10px; right:10px; } .image_post img { width:100%; border:1px solid #ccc; } .image_description { width:100%; padding-bottom:8px; background:white; text-align:left; color:#000; margin-top:-10px; } .image_post input[type="submit"] { border:0; position:absolute; top:30p

mysql - Can't run a db migration on rails -

i have had ongoing trouble migrating database in rails via rake db:migrate. my migration looks this: class createarticles < activerecord::migration def change create_table :articles |t| t.string :title t.text :subtitle t.string :slug t.text :body t.integer :publish, limit: 1, default: 0 t.timestamps end end end however if ever delete column or add or modify 1 rake db:migrate command nothing. way can migrate running like: rake db:migrate version=20080906120000 but temperamental of time need reset db using db:drop db:create then running migration again normal. db:migrate ever works first time after dropping , creating db. i've tried rollback before running migration. this far ideal i'd appreciate help. (i realise there similar questions of issues solved after db reset) you need run migration down , run up again, done redo task. try this: rake db:migrate:redo version=20080906120000 edit: if have data w

curl - CouchDB View Multiple key-value pairs -

i'm new couchdb , want specify year-range set of documents. each document has year attribute. have defined view follows: function(doc) { emit(parseint(doc.year), doc.title); } i want select movies made between (for example) 2000 , 2005. far can understand, following curl command should work this. curl http://127.0.0.1:5984/movies/_design/exercises/_view/ex11?startkey=2000&endkey=2005 however, when execute command, first key-value pair seems take effect (i.e. selects movies after 2000). if interchange order of startkey , endkey pairs case (i.e. selects movies before 2005) furthermore, when execute curl command above, seems program not terminate in terminal. have manually terminate query using ctrl+c, doesn't happen other type of query. each movie has following json structure (for reference): { "_id": "uf", "_rev": "1-576d70babcd04fed2918f5c543bb7cf6", "title": "unforgiven", "ye

php - How to save and retrieve latitude and longitude from a point in Symfony2 and Doctrine2 -

i have symfony2/doctrine application has need store , retrieve latitude/longitude values. i've found plenty of bundles handle geolocation, appears people's needs different own , can't seem solve simple problem... all need @ moment save latitude , longitude properties of entity point column, , when entity loaded, load latitude , longitude point. i've followed http://codeutopia.net/blog/2011/02/19/using-spatial-data-in-doctrine-2/ , have "location" property on entity maps point column. great. don't quite see how set point lat/long, or how retrieve lat/long point, without doing custom dql time need load/save entity. in non-symfony/doctrine application like: "select *, x(location) latitude, y(location) longitude from... load latitude , longitude, sf2 , doctrine can't seem figure out need do. can point me in right direction? considering entity has field of "point" type linked, manipulating coordinates simple in these

internet explorer - PHP header redirection issue: Not going where it should -

i have admin page in app i've developed allows users logged in site admin click link automatically log in specific user (bypassing password entry). once app has set necessary session variables log in chosen user, there's block of code looks this: if ($login->loginasuser($_post['selecteduser']) === true) { //redirect user page error_log ("redirect user.php"); //die("breakpoint 1"); header("location: user.php"); exit; } else { die("login error"); } (it's ok - i'm validating post variable before this). $login->loginasuser(id) method of login class. destroys current session , creates new 1 user login, , returns true if ok. as can see, i've added code write message apache error log before redirect. message appears correctly in log every time code runs. 90% of time happens redirect index.php, not user.php. also, mis-redirection seems occur in internet explorer (version 11 , previo

titanium - Appcelerator ti.paint module won't load image on android -

i have error ti.paint module on android. whenever try set image, application crashes (works fine on ios) i've try several codes : var paintview = paint.createpaintview({ top:0, right:0, bottom:80, left:0, image : "images/doge.png", erasemode : true, strokewidth : 70 }); and image : "/images/doge.png" also image = "http://dogr.io/doge.png" and finally var dogefile = titanium.filesystem.getfile(ti.filesystem.resourcesdirectory, 'images/doge.png'); var paintview = paint.createpaintview({ top:0, right:0, bottom:80, left:0, image : dogefile.nativepath, erasemode : true, strokewidth : 70 }); but application crash each time on android (works fine on ios). i've tried jpeg images, , null value. here error message i'm getting in console [error] tiapplication: (main) [0,205] sending event: exception on thread: main msg:java.lang.runtimeexception: unable start activity componentinfo{wow.much