Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)
New Posts  All Forums:Forum Nav:

Programmers' lounge. (Programming-related discussions only) - Page 106

post #1051 of 1143
you took it so far out of line and context it's ridiculous. it was an offhand suggestion, so stop trying to "levitate" above me. are you seriously arguing with my use of the word "should"? really?

you're not an idiot. stop treating me like i'm some dumb hippie who doesn't know what he's doing so he only uses the FOTM tools. jeez. and don't elevate yourself above people like "we should use tools and not products, that's how I think and you are wrong blisse". i understand the ideology but the nerve of talking to me like that is insane.

sorry for arguing but how can I not be annoyed here by some guy jumping on to my one line comment asking someone else to host their content so we can see their code.
Edited by dBlisse - 3/18/15 at 2:41pm
post #1052 of 1143
Quote:
Originally Posted by dBlisse View Post

you took it so far out of line and context it's ridiculous. it was an offhand suggestion, so stop trying to "levitate" above me. are you seriously arguing with my use of the word "should"? really?

you're not an idiot. stop treating me like i'm some dumb hippie who doesn't know what he's doing so he only uses the FOTM tools. jeez. and don't elevate yourself above people like "we should use tools and not products, that's how I think and you are wrong blisse". i understand the ideology but the nerve of talking to me like that is insane.

sorry for arguing but how can I not be annoyed here by some guy jumping on to my one line comment asking someone else to host their content so we can see their code.

I'm not trying to levitate above you. My point was sincere, albeit inappropriately phrased (hence the apology at the start of my previous post)
post #1053 of 1143
oops sorry, didn't see your earlier sorry somehow... thanks, just got a bit angry there
post #1054 of 1143
Quote:
Originally Posted by dBlisse View Post

oops sorry, didn't see your earlier sorry somehow... thanks, just got a bit angry there

Understandable really smile.gif
post #1055 of 1143
I'm working on a little image viewer that operates heavily on tags, if anyone has used a booru (like safebooru) you'll get the idea. Each image stores the tags that it has but I can't decide how to store them. When I view an image I want the tags to be on the side in alphabetic order, but I also want to be able to search by multiple tags. What data structure should I be using here? I thought Java's standard hashmap at first but I would have to sort the tags every time an image is viewed, though it could be faster to search. On the other hand an array could be presorted (sort only when tags are added) but it would be longer to search.

I'm thinking about an array of linked lists or something. With the first character of each tag being hashed to a unique spot on the array. It could be presorted and could speed up search by tag. Any other ideas?
New and Shiny
(18 items)
 
  
CPUMotherboardGraphicsRAM
Rynze 7 1700 ASUS ROG Crosshair VI Hero Sapphire HD7950 G.SKILL TridentZ F4-3200C14D 
Hard DriveHard DriveHard DriveHard Drive
Kingston HyperX 3K Crucial MX300 Western Digital Black Western Digital Green 
Hard DriveCoolingOSMonitor
Western Digital Red Noctua NH-U14S Windows 10 Pro Dell U2414H 
MonitorKeyboardPowerCase
Dell P2414H Ducky One Corsair RM650x NZXT H440 White 
MouseAudio
Logitech G502 Proteus Spectrum Xonar DX 
  hide details  
Reply
New and Shiny
(18 items)
 
  
CPUMotherboardGraphicsRAM
Rynze 7 1700 ASUS ROG Crosshair VI Hero Sapphire HD7950 G.SKILL TridentZ F4-3200C14D 
Hard DriveHard DriveHard DriveHard Drive
Kingston HyperX 3K Crucial MX300 Western Digital Black Western Digital Green 
Hard DriveCoolingOSMonitor
Western Digital Red Noctua NH-U14S Windows 10 Pro Dell U2414H 
MonitorKeyboardPowerCase
Dell P2414H Ducky One Corsair RM650x NZXT H440 White 
MouseAudio
Logitech G502 Proteus Spectrum Xonar DX 
  hide details  
Reply
post #1056 of 1143
Quote:
Originally Posted by geoxile View Post

... but I also want to be able to search by multiple tags. What data structure should I be using here?

An interesting and often occurring task you are wrestling with.
The ugliest way to do it is to presort every time, you can expand the idea of "hashing" the first character to 2 but this also is not fast.
Since you mention the need for multiple tags why don't you "rip" all the tags (or tag-fields) as words (or numbers for that matter) and put them into B-tree or Binary tree!?

I tried that approach in my word-ripping tool Leprechaun while enforcing all the B-TREE to be on external memory (a single file).
If you are interested you can copy the corresponding sections from the C source at: http://www.sanmayce.com/MSKR/
That way you can access 100 million tags with just 4 READ SEEKS.

The downside of BTREE is its relative complexity, I still wonder is there a better/easier way to search into multi-millions of records/tags/strings!
post #1057 of 1143
Just saw a single instance for TAGS on http://safebooru.org/index.php?page=post&s=view&id=1457264
Code:
Tags

    blush 237318
    braids 507
    brown hair 226620
    idolmaster 33402
    idolmaster cinderella girls 13312
    long hair 522306
    ninomiya asuka 45
    purple eyes 95322

As I thought it is a matter of word ripping, you need just to rip the tags as n-grams, that is, as phrases. Each phrase is n words long, for example:
idolmaster cinderella girls
becomes the 3-gram idolmaster_cinderella_girls or a single sub-tag or tag-field, in fact a element in the BTREE.
On second thought, if images are only few millions (their tags fittable in RAM) maybe BTREE is an overkill.
Edited by Sanmayce - 5/20/15 at 3:47pm
post #1058 of 1143
So just put the entire tag in B-Tree? Would in-order traversal always give alphabetic ordering?
New and Shiny
(18 items)
 
  
CPUMotherboardGraphicsRAM
Rynze 7 1700 ASUS ROG Crosshair VI Hero Sapphire HD7950 G.SKILL TridentZ F4-3200C14D 
Hard DriveHard DriveHard DriveHard Drive
Kingston HyperX 3K Crucial MX300 Western Digital Black Western Digital Green 
Hard DriveCoolingOSMonitor
Western Digital Red Noctua NH-U14S Windows 10 Pro Dell U2414H 
MonitorKeyboardPowerCase
Dell P2414H Ducky One Corsair RM650x NZXT H440 White 
MouseAudio
Logitech G502 Proteus Spectrum Xonar DX 
  hide details  
Reply
New and Shiny
(18 items)
 
  
CPUMotherboardGraphicsRAM
Rynze 7 1700 ASUS ROG Crosshair VI Hero Sapphire HD7950 G.SKILL TridentZ F4-3200C14D 
Hard DriveHard DriveHard DriveHard Drive
Kingston HyperX 3K Crucial MX300 Western Digital Black Western Digital Green 
Hard DriveCoolingOSMonitor
Western Digital Red Noctua NH-U14S Windows 10 Pro Dell U2414H 
MonitorKeyboardPowerCase
Dell P2414H Ducky One Corsair RM650x NZXT H440 White 
MouseAudio
Logitech G502 Proteus Spectrum Xonar DX 
  hide details  
Reply
post #1059 of 1143
Ok I was searching in this thread for my post, but idk what happen to it.

In android I have it create a new thread when a user connects, that way each user is on its own thread. How can I choose which user to interact with since its in its own thread?
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
post #1060 of 1143
Quote:
Originally Posted by andyroo89 View Post

Ok I was searching in this thread for my post, but idk what happen to it.

In android I have it create a new thread when a user connects, that way each user is on its own thread. How can I choose which user to interact with since its in its own thread?

Firstly, you should (if not already) have references to each thread, save them in an List for example. Then, you can iterate through the List to find the thread serving the specific user you want. Alternatively, if you have an identifier for each user, and know what identifier you should interact with, a Map would be a better choice than a List, there the Key is the identifier, and the Value is the Thread where the user with the said identifier is "connected to". I can give more specific examples if you have some code to share for the relevant parts (the 'connecting' part, thread creation, where and how you would like to interact with a user etc)
Minimachine
(9 items)
 
  
CPUMotherboardGraphicsRAM
i7-5775C Asus Maximus VII Impact EVGA GTX1080 Founders edition 2x8GB Kingston HyperX 1600Mhz 
Hard DriveMonitorPowerCase
Samsung 950 PRO 512GB M.2 NVMe 3x Asus PB287Q 4k Silverstone 600W Strider SFX NCASE M1 Rev 2 
  hide details  
Reply
Minimachine
(9 items)
 
  
CPUMotherboardGraphicsRAM
i7-5775C Asus Maximus VII Impact EVGA GTX1080 Founders edition 2x8GB Kingston HyperX 1600Mhz 
Hard DriveMonitorPowerCase
Samsung 950 PRO 512GB M.2 NVMe 3x Asus PB287Q 4k Silverstone 600W Strider SFX NCASE M1 Rev 2 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)